This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSC 124 9142007 18. The following two programs have syntax mistakes. Correct them. On each successive line, assume that any preceding error has been corrected. A. #include <iostream> const int PRIME = 11,213; const RATE = 15.6 ; int main ( ) { int i, x, y, w; x = 7 y = 3 x = x + w; PRIME = x + PRIME; cout << PRIME << endl; wages = RATE * 36.75; cout << “Wages = “ << wages << endl; return 0; } B. #include <iostream> const char BLANK = ‘ ‘ ; const int ONE 5; int main ( ) { int a, b, cc; a = ONE + 5 b = a + BLANK; cc = a + ONE * 2; b = a + cc; ONE = b + c cout << “a = “ << a << “, b = “ << b << “, cc = “ << cc << endl’ return 0; } 19. Write the equivalent compound statement if possible. A. x = 2 * x x *= 2; B. x = x + y – 2; x += y – 2; C. sum = sum + num; sum += num; D. z = z * x + 2 * z; z *= x + 2; E. y = y / (x+5); y /= x+5 ; 20. Write the following compound statements as equivalent simple statements. A. x += 5 – z; x = x + 5 – z; B. y *= 2 * x + 5 – z; y = y * 2 * x + 5 – z; C. w += 2 * z + 4; w = w + 2 * z +4; D. x = z + y – t;D....
View
Full
Document
This note was uploaded on 04/21/2008 for the course CSC 124 taught by Professor Salim during the Fall '07 term at California University of Pennsylvania.
 Fall '07
 Salim

Click to edit the document details