3-----key1[1]

3-----key1[1] - Exam 1, 10/22/07 PIC 10A, Fall 2007 KEY...

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

View Full Document Right Arrow Icon
Page 1 Exam 1, 10/22/07 PIC 10A, Fall 2007 KEY _____ Cau _____ Ryan _____ Jacob _____ Michael You have 50 minutes to complete this exam. You are not allowed to use any books, notes, calculators, or electronic devices. Write your answers carefully. Incomplete, unintelligible, or illegible answers will receive little or no credit. When you are asked to write a program, it is not necessary to comment your code but you are expected to indent appropriately to make your code easier to follow. There are a total of 50 points on this exam. PAGE SCORE POSSIBLE 1 8 2 8 3 10 4 12 5 12 TOTAL 50 T 1.) [2 points] Write a single cout statement that prints the text below. Frodo says: (Hint: The heart is given by the escape character \3.) cout << "Frodo says:\n\"I \3 YOU!\"" 2.) [6 points] The following program is supposed to get an input phrase from the user and replace every other character with an asterisk *, starting with the second letter. So the phrase "LORD OF THE RINGS" becomes "L*R* *F*T*E*R*N*G*". The program compiles, but does not seem to run correctly. 1 int main ( ) { 2 cout << "Enter a phrase: " 3 string phrase 4 cin >> phrase 5 int x = 1 6 while (x <= phrase.length() ) { Check your TAhs name: I . YOU!
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.

Page1 / 12

3-----key1[1] - Exam 1, 10/22/07 PIC 10A, Fall 2007 KEY...

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