Lecture Notes

Lecture Notes - January 25, 2010 Modularity...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
January 25, 2010 Modularity Classes/structures Functions - 5 [square()] 25 Identifiers example: Int main() { Int a; A = 5; B = square(a); Cout<<:The square of”<<a<<”is”<<b<<endl; Return 0; } Identifiers A, b ,number, square, xqf3221 Keywords (about 50 listed in the book) Int, if, return The main() Function Where the program starts executing Example
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Int main() Int num Insigned int u = 50; Char c; Num = 100; C = ‘x’; Cout<< “the character is”<<t<<endl; Cout<<”the number is”<<num<<endl; Num = num + c Cout<<”the character is now”<<c<<endl; Cout<<”the number is now”<<num<<endl; Cout<<”the character and number respectively”<<”occupy”<< January 27, 2010 Arithmetic operators 14/3 = = 4 (quotient without the remainder) 14%3 == 2 (remainder without the quotient) 61+14/3 == 65 (61+14)/3==25 Precedence * / % higher + - lower Char(61+14/3)==’A’ February 1, 2010 double
Background image of page 2
11 bits (exponents) | 52 bits (mantissa) <______________64 bits____________________> Char – 8 bits Int - 32 bits -128 thru +127 Discuss Int sum = 25; Sum = sum + 10; Cout << sum << endl; (sum = 35)) Or Int sum = 25; Sum += 10; Cout << sum << endl;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

Lecture Notes - January 25, 2010 Modularity...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online