CSC 124
9102007
10. Write C++ statements that accomplish the following:
A. Declares
int
variables x and y. –
int x, y;
C. Updates the value of an
int
variable x by adding 5 to it. –
x = x+5;
D. Sets the value of a
double
variable z to 25.3 –
double z; z = 25.3;
E.
Copies the content of an
int
variable y into an
int
variable z. –
int y, z; y=z
H. Declares a
char
variable grade and sets the value of grade to ‘A’. 
char grade; grade = ‘A’;
J.
Copies the value of a
double
variable z to the nearest integer into an
int
variable
x.
double z; int x; z = x;
11. Write each of the following as a C++ expression.
A. –10 times a
10 * a
B. The character that represents 8
‘8’
C. (b + (b^2 – 4ac)) / 2a
(b + (b^2 – 4 * a * c)) / 2 * a
12. Suppose
x, y, z, and w are
int
variables. What value is assigned to each of these
variables after the last statement execute?
x = 5, z3;
y = x – z;
z = 2 * y + 3;
w = x – 2 * y + z;
z = w – x;
w++;
x = 5, y = 2, z = 2, w = 4
13. Suppose x, y, and z are
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 Salim
 ASCII, Carriage return, Newline, 15 %, line feed, int variables

Click to edit the document details