This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: original, but the changed program uses a while loop instead of a for loop for the inner loop. Copy the program you wrote for problem 3 and update it so that for any input number, it behaves the same way, but uses a do-while loop instead of a for loop for the outer loop. Be careful! (Hint: How does it behave if len is not positive? You may need to add a little additional code to make sure the program behaves identically to the program in problem 3.) Assume month has been previously declared as an int and given a meaningful value. Write a switch statement that for any value of month , produces exactly the same output as the following if statement. if (month == 6) cout << "summer solstice"; else if (month == 12) cout << "winter solstice"; else if (month == 3 || month == 9) cout << "equinox"; else cout << "nothing special";...
View Full Document
This note was uploaded on 11/07/2009 for the course CS 31 taught by Professor Melkanoff during the Spring '00 term at UCLA.
- Spring '00