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

来源:互联网 发布:vb猜数游戏程序 编辑:程序博客网 时间:2024/06/05 12:46
以下程序通过使用算术运算符,计算8*2-9/10*20。程序代码如下:
#import <Foundation/Foundation.h>int main(int argc, const char * argv[]) {    @autoreleasepool {        // insert code here...        NSLog(@"Hello, This is a sample 3.4 of the book 《iOS7 开发快速入门》!");        float a;        a = 8*2-9/10*20;        NSLog(@"%f",a);    }    return 0;}
运行结果如下:
2015-01-18 11:08:22.514 Sample.3.4[1021:65109] Hello, This is a sample 3.4 of the book 《iOS7 开发快速入门》!
2015-01-18 11:08:22.516 Sample.3.4[1021:65109] 16.000000
Program ended with exit code: 0
0 0