Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. int main( )
  9. {
  10.  
  11. const int huge_box = 50;
  12. const int large_box = 25;
  13. const int medium_box = 10;
  14. const int small_box = 1;
  15. int doodles;
  16. int huge_doodle;
  17. int large_doodle;
  18. int medium_doodle;
  19. int small_doodle;
  20.  
  21. cout << "Enter the number of doodles to be shipped: ";
  22. cin >> doodles;
  23. cout << endl;
  24.  
  25. cout << "For shipment of " << doodles << " doodles: " << endl << endl;
  26. cout << "Container Number" << endl;
  27. cout << "-----------------------" << endl;
  28.  
  29.  
  30. huge_doodle = doodles % huge_box;
  31. large_doodle = doodles % large_box;
  32. medium_doodle = doodles % medium_box;
  33. small_doodle = doodles % small_box;
  34.  
  35.  
  36. cout << "Huge" << setw(18) << huge_doodle << endl;
  37. cout << "Large" << setw(17) << large_doodle << endl;
  38. cout << "Medium" << setw(16) << medium_doodle << endl;
  39. cout << "Small " << setw(16) << small_doodle << endl;
  40.  
  41.  
  42. ofstream fout;
  43. fout.open("Prog2_out.txt");
  44.  
  45. fout << "For shipment of " << doodles << " doodles:" << endl << endl;
  46. fout << "Container Number" << endl;
  47. fout << "-------------------------" << endl;
  48. fout << "Huge " << huge_doodle << endl;
  49. fout << "Large " << large_doodle << endl;
  50. fout << "Medium " << medium_doodle << endl;
  51. fout << "Small " << small_doodle << endl;
  52.  
  53. cout << endl << endl;
  54. cout << "Program results have also been written to Prog2_out.txt." << endl;
  55.  
  56. fout.close();
  57.  
  58. system("pause>nul");
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement