C HW3 - fout<<"|" for star star> 0 star/Displays start representing fish caught in each lake fout<<"" fout<< endl

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

View Full Document Right Arrow Icon
//Homework #3 //This program will calculate and illustrate the statisical values of fish caught in Maine lakes #include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { ofstream fout; fout.open( "Fishing.txt" ); int fish; //Fish caught in each lake int lakes = 0; //Number of Lakes fished in int max = 0; //Max number of fish caught in one lake int min; //Min number of fish caught in one lake double totalfish = 0; //Total number of fish caught double average; //Average number of fish caught cout << "How many fish were caught? (enter -1 to end data entry)" ; cin >> fish; fout << " \n\n" ; while (fish != -1) { int star = fish; //Number of stars to display per lake if (max <= fish) { max = fish; } else { } if (min >= fish) { min = fish; } else { }
Background image of page 1

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

View Full DocumentRight Arrow Icon
lakes ++; totalfish = totalfish + fish;
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fout << "|" ; for ( star; star > 0; star--) //Displays start representing fish caught in each lake fout << "*" ; fout << endl; cin >> fish; } average = totalfish / lakes; fout << endl << setw(10) << "Number of values:" << setw (14) << lakes << endl; fout << setw(10) << setprecision (4) << "Average number of fish:" <<setw (8) << average << endl; fout << setw(10) << "Maximum number of fish:" <<setw (8) << max << endl; fout << setw(10) << "Minimum number of fish:" <<setw (8) << min << endl; fout.close(); return 0; } Steve Carr |********** |************ |*************** |***** Number of values: 4 Average number of fish: 10.5 Maximum number of fish: 15 Minimum number of fish: 5...
View Full Document

This homework help was uploaded on 04/18/2008 for the course COS 220 taught by Professor Roberts during the Spring '08 term at University of Maine Orono .

Page1 / 2

C HW3 - fout<<"|" for star star> 0 star/Displays start representing fish caught in each lake fout<<"" fout<< endl

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