For each of the following, correct the syntax errors.
1. if (x > 25.0) y = x; else y = z; 2. if (x > 0) cout << "positive " << x << endl; else cout << "negative " << x << endl;
What is the output of each of the following statements? Assume that each problem uses the values x = 5, y = 2, z = 10, and temp = 0
3. 5 2 10 4. (nothing is printed) 5. 10 2 0 6. 10 2 5 7. 7 8. -8 2 10 14. if (angle == 90) cout << "right angle\n"; else cout << "not a right angle\n"; 15. if (temp1 - temp2 > 2.3) approx = (temp1 - temp2) * factor; 16. if (credits >=122) cout << "You are ready to graduate\n"; else cout << "You are not ready to graduate\n";
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002