Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <iomanip>
- #include <fstream>
- using namespace std;
- int main( )
- {
- const int huge_box = 50;
- const int large_box = 25;
- const int medium_box = 10;
- const int small_box = 1;
- int doodles;
- int huge_doodle;
- int large_doodle;
- int medium_doodle;
- int small_doodle;
- cout << "Enter the number of doodles to be shipped: ";
- cin >> doodles;
- cout << endl;
- cout << "For shipment of " << doodles << " doodles: " << endl << endl;
- cout << "Container Number" << endl;
- cout << "-----------------------" << endl;
- huge_doodle = doodles % huge_box;
- large_doodle = doodles % large_box;
- medium_doodle = doodles % medium_box;
- small_doodle = doodles % small_box;
- cout << "Huge" << setw(18) << huge_doodle << endl;
- cout << "Large" << setw(17) << large_doodle << endl;
- cout << "Medium" << setw(16) << medium_doodle << endl;
- cout << "Small " << setw(16) << small_doodle << endl;
- ofstream fout;
- fout.open("Prog2_out.txt");
- fout << "For shipment of " << doodles << " doodles:" << endl << endl;
- fout << "Container Number" << endl;
- fout << "-------------------------" << endl;
- fout << "Huge " << huge_doodle << endl;
- fout << "Large " << large_doodle << endl;
- fout << "Medium " << medium_doodle << endl;
- fout << "Small " << small_doodle << endl;
- cout << endl << endl;
- cout << "Program results have also been written to Prog2_out.txt." << endl;
- fout.close();
- system("pause>nul");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement