Objective-C Programming (Sixth Edition) Chapter 2 Exercise answers

Source: Internet
Author: User

 

1. Omitted

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. Procedures after correction

Int sum; <--- the original int is changed to int.
/* Compute result */<--- comments on the right of the original text // change */. sum = 25 + 37-19; <--- end with a semicolon after the original text. /* Display Results */<--- change the original comment /*.. * // or //. nslog (@ "The answer is % I", sum); <--- replace the original text with double quotation marks, and add a comma before sum.

6.

The result is 95.

 

 

End

Objective-C Programming (Sixth Edition) Chapter 2 Exercise answers

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.