&NBSP;&NBSP;FRACTION.H//&NBSP;&NBSP;OC12 Preprocessing program////&NBSP;&NBSP;CREATED&NBSP;BY&NBSP;ZOUJIE&NBSP;ON&NBSP;15/9 /17.// copyright (c) Replacement of general predefined constants for 2015 year zoujie. all rights reserved.//// #define kture 1#define kfalse 0#define pi 3.141592#define maximum_data_ values 1000//more advanced pre-defined #define two_pi 2.0 * 3.141592654#define and &&# define or | | #define equals == #define &NBSP;TWO_PI_DEFINE&NBSP;2.0&NBSP;*&NBSP;PI//with parameter #define is_leap_year (y) y%4 == 0 && y%100 !=0 | | y%400==0 #define &NBSP;SQUARE (x) x * x //arithmetic error x representative expression: x = y + 1#define square_ture (x) ((x) * (x)) #define makefract, X, y ([[fraction Alloc]initwith: x over :y]) //? #define max_two_number (A, B) (((a) > (a)) ? (a):(B)) //judge two parameters largeSmall #define ipad //declaration #import <foundation/foundation.h>//<> system Header File @interface fraction : nsobject-(void) defineproduct;-(double) area;-(double) circumference;-(void) initwith:x over:y; @end
&NBSP;&NBSP;FRACTION.M//&NBSP;&NBSP;OC12 Preprocessing program////&NBSP;&NBSP;CREATED&NBSP;BY&NBSP;ZOUJIE&NBSP;ON&NBSP;15/9 /17.// copyright (c) 2015 year zoujie. all rights reserved.//#import "Fraction.h" @implementation fraction{ int radius ;//radius}-(void) defineproduct{ int gameover = kfalse; if ( Gameover == kfalse) { gameover = kTURE; } if (gameover >0 and (gameover <= 1)) {} if (gameover >0 or (gameover <= 1)) {} }-(double) area{ radius = 10; return PI * Radius * radius;} -(DouBLE) circumference{ return 2.0 * PI * radius; return two_pi * radius; return two_pi_define * radius;} -(void) Initwith: (ID) X over: (id) y{ return ;} @end
&NBSP;&NBSP;MAIN.M//&NBSP;&NBSP;OC12 preprocessor////&NBSP;&NBSP;CREATED&NBSP;BY&NBSP;ZOUJIE&NBSP;ON&NBSP;15/9/17. Copyright (c) 2015 year zoujie. all rights reserved.//#import <Foundation/Foundation.h> #import "Fraction.h" #import <limits.h> #import <float.h >int main (int argc, const char * argv[]) { @ Autoreleasepool { if (Is_leap_year ()) { nslog (@ "Judging leap Year"); } nslog (@ "%d", Max_two_number (100, 99)); } return 0;} #pragma mark conditional Compilation #ifdef ipad //ipad declaration can #define kimagefile @ "bardhd.png" #else # define kimagefile @ " Barn.png "#endif//for commenting on #if 0#endif#undef statements//making some names that have already been underground palace as undefined #undef ipad //eliminate IPAD #ifdef IPAD #if defined (IPAD) judgment is false
OC Pre-processing program