首页 > 代码库 > Objective-C 程序设计(第六版)第二章习题答案
Objective-C 程序设计(第六版)第二章习题答案
1.略
2.
#import <Foundation/Foundation.h>int main(int argc, const char * argv[]){ @autoreleasepool { // insert code here... NSLog(@"In Obiective-c, lowercase letters are significance .\n main is where program execution begins.\n Open and closed brace enclose program stateme nts in a routine .\n All program statements must be terminated by a semicolon .");
}
return 0;
}
3.
testing...
.... 1
... 2
.. 3
4.
int value1, value2, sum;
value1 = 87; value2 = 15; sum = value1 - value2; NSLog(@"sum is %i", sum);
5.改正后的程序
int sum; <---原文INT改为int.
/* COMPUTE RESULT*/ <---原文右注释号//改为*/. sum = 25+37-19; <---原文后加分号结束. /* DISPLAY RESULTS*/ <---原文注释号改为/*..*/或//. NSLog(@"The answer is %i",sum); <---原文改为双引号,加上sum前的逗号.
6.
The result is 95.
END
Objective-C 程序设计(第六版)第二章习题答案
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。