码迷,mamicode.com
首页 > 其他好文 > 详细

Objective-C 程序设计(第六版)第二章习题答案

时间:2014-09-13 19:58:45      阅读:318      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   strong   div   sp   

 

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 程序设计(第六版)第二章习题答案

标签:style   blog   color   io   os   ar   strong   div   sp   

原文地址:http://www.cnblogs.com/MingMing-King/p/3970158.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!