Assignment3 - CSC 124 9-10-2007 10. Write C+ statements...

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

View Full Document Right Arrow Icon
CSC 124 9-10-2007 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, z-3; 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 2

Assignment3 - CSC 124 9-10-2007 10. Write C+ statements...

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

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