objective-c第十二章练习答案

第二题和第三题

#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)))




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值