fork download
  1.  
  2. //*********************** Preprocessor Directives *********************
  3. #include <fstream>
  4. #include <iostream>
  5. #include <iomanip>
  6. #include <string>
  7. #include <cmath>
  8. #include <stdlib.h>
  9.  
  10. // Namespace
  11. using namespace std;
  12. //******************************* main ********************************//
  13.  
  14. int main()
  15.  
  16. { //Declaration Section
  17.  
  18. const double TAX_RATE = 0.07,
  19. COST_REPRINT = 0.50;
  20.  
  21.  
  22.  
  23. int num_reprint,
  24. num_photos, // num_photos * num_reprint ;
  25. tot_reprint , // tot_reprint * cost_reprint ;
  26. tax_amt, // tot_cost * TAX_RATE ;
  27. tot_cost; // cost_reprint + tax_amt ;
  28. char name[30], // Customer Name (first and last) ;
  29. date [12] ; // format mm/dd/yyyy ;
  30.  
  31.  
  32.  
  33. //********************* input section ************************** //
  34.  
  35. system ("cls");
  36. cout << "Customer Name: " ;
  37. cin.getline(name, (sizeof(name) - 1));
  38. cin>> ws;
  39. cout << "Date of Order: " ;
  40. cin.getline(date, (sizeof(date) - 1));
  41. cout << "Number of Photos: "
  42. ;cin >> num_photos;
  43. cout << "Number of Reprint: ";
  44. cin >> num_reprint;
  45. //process sectin
  46. num_photos = num_photos * num_reprint ;
  47. tot_reprint = tot_reprint * COST_REPRINT ;
  48. tax_amt = tot_cost * TAX_RATE ;
  49. tot_cost = COST_REPRINT + tax_amt ;
  50.  
  51. // output section
  52. system("cls");
  53. cout << setiosflags(ios::showpoint | ios::fixed) << setprecision (2) << fixed;
  54. cout << "More Prints Studio" << endl;
  55. cout << "~~~~~~~~~~~~~~~~~~~~~~~~~" << endl << endl;
  56. cout << "Customer Name" <<name << endl << endl;
  57. cout << "Order Date " << date << endl << endl;
  58. cout << "Reprint Cost " << COST_REPRINT << endl;
  59. cout << "Tax Amount " << tax_amt << endl;
  60. cout << "Total Cost " << tot_cost << endl;
  61.  
  62. cout << endl << endl; //provides blank line before pause display message
  63. system("pause");
  64. return 0;
  65. }
  66.  
Success #stdin #stdout #stderr 0s 3300KB
stdin
Standard input is empty
stdout
Customer Name: Date of Order: Number of Photos: Number of Reprint: More Prints Studio
~~~~~~~~~~~~~~~~~~~~~~~~~

Customer Name

Order Date 

Reprint Cost 0.50
Tax Amount 0
Total Cost 0


stderr
sh: cls: not found
sh: cls: not found
sh: pause: not found