您的位置:首页 > 移动开发 > IOS开发

【iOS7开发快速入门】代码示例3-10

2015-01-18 23:50 281 查看
以下程序通过使用if语句,判断变量a的值是否小于9,如果小于就输出a的值。程序代码如下:

#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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: