Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9. // declare variables
  10.  
  11. double store1 =0.0;
  12. double store2 =0.0;
  13. double store3 =0.0;
  14. int storeNumber =0;
  15. int amount =0;
  16. double total =0.0;
  17.  
  18.  
  19. cout << "Enter a store number or -1 to end: ";
  20. cin >> storeNumber;
  21. cout << endl;
  22.  
  23.  
  24. while (storeNumber !=-1) ; // begin loop
  25. {
  26.  
  27.  
  28. cout << "Enter a payroll amount:$ ";
  29. cin >> amount;
  30.  
  31. cout << endl;
  32.  
  33. if (storeNumber == 1); //store 1
  34. {
  35. cout << "Enter a store number or -1 to end: ";
  36. cin >> storeNumber;
  37.  
  38. cout << "Enter payroll amount:$ ";
  39. cin >> store1;
  40.  
  41. store1 += amount;
  42.  
  43.  
  44. }
  45. cout << endl;
  46.  
  47. if (storeNumber == 2); // store 2
  48. {
  49. cout << "Enter a store number or -1 to end: ";
  50. cin >> storeNumber;
  51.  
  52. cout << "Enter payroll amount:$ ";
  53. cin >> store2;
  54.  
  55. store2 += amount;
  56.  
  57.  
  58. }
  59.  
  60. cout << endl;
  61.  
  62. if (storeNumber == 3); //store 3
  63. {
  64. cout << "Enter a store number or -1 to end: ";
  65. cin >> storeNumber;
  66.  
  67. cout << "Enter payroll amount:$ ";
  68. cin >> store3;
  69.  
  70. store3 += amount;
  71.  
  72.  
  73. }
  74.  
  75. cout << endl;
  76.  
  77. cout << "Enter a store number or -1 to end: ";
  78. cin >> storeNumber;
  79.  
  80.  
  81.  
  82. }
  83.  
  84. cout << endl;
  85.  
  86. //print
  87. cout << "Store 1 payroll is :$ " << store1 << endl;
  88. cout << "Store 2 payroll is :$ " << store2 << endl;
  89. cout << "Store 3 payroll is :$ " << store3 << endl;
  90.  
  91. cout << "Total payroll is : $ " << total << endl;
  92.  
  93. return 0;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement