以下程序通过使用关系运算符实现运算。程序代码如下:
2015-01-18 12:24:34.076 Sample.3.6[1103:76207] Hello, This is a sample 3.6 of the book 《iOS7 开发快速入门》!
2015-01-18 12:24:34.077 Sample.3.6[1103:76207] 1
2015-01-18 12:24:34.077 Sample.3.6[1103:76207] 0
2015-01-18 12:24:34.077 Sample.3.6[1103:76207] 0
Program ended with exit code: 0
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSLog(@"Hello, This is a sample 3.6 of the book 《iOS7 开发快速入门》!");
NSLog(@"%i",2>1);
NSLog(@"%i",2<1);
NSLog(@"%i",2==1);
}
return 0;
}
运行结果如下:
2015-01-18 12:24:34.076 Sample.3.6[1103:76207] Hello, This is a sample 3.6 of the book 《iOS7 开发快速入门》!
2015-01-18 12:24:34.077 Sample.3.6[1103:76207] 1
2015-01-18 12:24:34.077 Sample.3.6[1103:76207] 0
2015-01-18 12:24:34.077 Sample.3.6[1103:76207] 0
Program ended with exit code: 0