第二题和第三题
#import <Foundation/Foundation.h>
#define DeMIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c)))
int main(int argc, const char * argv[]) {
@autoreleasepool {
int X,Y;
int limit;
NSLog(@"inter x and y.");
scanf("%i %i",&X,&Y);
limit = DeMIN(X,Y);
NSLog(@"%i",limit);
int a,b,c;
int limit3;
NSLog(@"inter a and b and c.");
scanf("%i %i %i",&a,&b,&c);
limit3 = MAX3(a,b,c);
NSLog(@"%i",limit3);
}
return 0;
}
第四题、
#define IS_UPPER_CASE(x) (((x)>='A')&&((x)<='Z'))
char x;
NSLog(@"inter x.");
scanf("%c",&x);
if (IS_UPPER_CASE(x))
NSLog(@"1");
else
NSLog(@"0");
第五题、
#define IS_ALPHABETIC(x) (IS_UPPER_CASE(x)) || (IS_LOWER_CASE(x))
第六题、
#define IS_DIGIT(x) (((x)>=0)&&((x)<=9))
#define IS_SPECIAL(X) (!(IS_DIGIT(X))&&!(IS_ALPHABETIC(x)))
第七题、
#define ABSOLUTE_VALUE(X) (((X)>0)?(X):(-(X)))