以下程序通过使用if语句,判断变量a的值是否小于9,如果小于就输出a的值。程序代码如下:
运行结果如下:
2015-01-18 23:47:40.342 Sample.3.10[1212:100530] Hello, This is a sample 3.10 of the book 《iOS7 开发快速入门》!
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.10 of the book 《iOS7 开发快速入门》!");
int a;
a = 10;
if (a<9) {
NSLog(@"%i",a);
}
}
return 0;
}
运行结果如下:
2015-01-18 23:47:40.342 Sample.3.10[1212:100530] Hello, This is a sample 3.10 of the book 《iOS7 开发快速入门》!
Program ended with exit code: 0