(2 points) The three basic flow-of-control patterns are sequence, ___________ and __________
(2 points) The three basic loop statements in C++ are while, _______, and _________
(2 points) Write a fragment of code that checks a string variable to see if it contains your first name or not, and then prints either "that's me" or "that's not me" accordingly. Assume that the string variable aName has a valid string in it before the test is made.
(2 points) Write a fragment of code that accepts integers from the user until a negative number is entered. The prompt should be "Enter a number (negative to quit):" Add up the numbers and print the sum (not including the negative number). Assume and use the following declarations:
int sum = 0; int num;
(2 points) Given the variables top, left, right, and bottom representing the coordinates of a rectangle's upper left and lower right corners, and variables ptX and ptY, representing the coordinates of a point, write a condition to test if the point is outside the rectangle. Assume that x increases to the right and that y increases to the top.
(2 points) Write a for loop that does exactly the same thing as the following code:
i = 1; while (i < 11) { cout << "the square root of " << i << " is " << sqrt(i); i += 2; }
(2 points) Create a symbolic constant named PI to represent the value of pi (3.14) in two different ways.
(2 points) Give two reasons why symbolic constants might be used in a C++ program.
(2 points) What will the following code fragment print?
for (i = 0; i < 5; i++); cout << i + 1; cout << i;
(2 points) Suppose
x = 0; y = 5;
Is the following condition true or false?
if (x > 0 && x < 10 || y = = 4)
(2 points) Which of the following is a legal way to create a C-style symbolic constant?