Average calc eas230

Average calc eas230 - // break out of while loop } total =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; int main () { char hold; double score = 0.0; double average = 0.0; double total = 0.0; int count = 0; // loop forever while (true ) { cout << "Enter next score, or negative number to finish "; cin >> score; if (score < 0) { break;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // break out of while loop } total = total + score; count = count + 1; } // end while true average = total / count; cout << "Average is: " << average << endl; cout << "Enter any character to close window "; cin >> hold; } // end Average.cpp...
View Full Document

This document was uploaded on 12/05/2011.

Ask a homework question - tutors are online