fork download
  1. //Xinnuo Wang CS1A chapter 5 , P.297, #18
  2. //
  3. /*******************************************************************************
  4. *
  5. * Display a bar chart
  6. *-------------------------------------------------------------------------------
  7. * This program display the population growth of Prairieville at 20-year intervals
  8. * during the past 100 years.The data can be found in the People.txt file.
  9. *
  10. *-------------------------------------------------------------------------------
  11. * INPUT
  12. * Outfile : The place to store data
  13. *
  14. *******************************************************************************/
  15. #include <iostream>
  16. #include <fstream>
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21. ofstream outfile;
  22. outfile.open("People.txt");
  23. outfile<<"PRAIRIEVILLE POPULATION GROWTH"<< endl;
  24. outfile<< "(each * represents 1,000 people)"<< endl;
  25. outfile<<"1900 **" << endl;
  26. outfile<<"1920 ****"<< endl;
  27. outfile<<"1940 *****"<< endl;
  28. outfile<<"1960 ********"<< endl;
  29. outfile<<"1980 **************" << endl;
  30. outfile<<"2000 ******************"<< endl;
  31. outfile.close();
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty