{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# homework5 - 5.4 1 This is an infinite loop and the"F in for...

This preview shows pages 1–4. Sign up to view the full content.

5.4 1. This is an infinite loop, and the “F” in for should not be capitalized. 2. The switch cases are without “break” statements. 3. This is an infinite loop that will display odd integers greater than 19. 4. The variable “counter” is not defined, the “W” in the while statement should not be capitalized, and the number 100 will not be output 5.6 // *********************************************************************** // File: average.cpp // // Finding an average - User enters in a series of integers, and the program // outputs the average of that set of integer. // // Author: Benjamin Jones // Created: 3 February 2008 // Updated: Original // // Assignment: Homework 5.6 // Compiler: MinGW32 G++ 3.4.2 (GNU) // // Inputs: User inputs a series of integers, until the user inputs a // the value 9999. // // Contraints: The user must a enter an integer. // // Outputs: The program will display the message, "The average of the set is: // <average>" // // *********************************************************************

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

View Full Document
// // Design: // // I. Begin loop while current input number (integer) is not 9999 // a. Ask user for next number // 1. Read input // c. If input is 9999 then continue the loop // d. Else add the input to the total sum // e. Increment a counter to indicate the number of numbers entered

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.

{[ snackBarMessage ]}