Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- int main()
- {
- // declare variables
- double store1 =0.0;
- double store2 =0.0;
- double store3 =0.0;
- int storeNumber =0;
- int amount =0;
- double total =0.0;
- cout << "Enter a store number or -1 to end: ";
- cin >> storeNumber;
- cout << endl;
- while (storeNumber !=-1) ; // begin loop
- {
- cout << "Enter a payroll amount:$ ";
- cin >> amount;
- cout << endl;
- if (storeNumber == 1); //store 1
- {
- cout << "Enter a store number or -1 to end: ";
- cin >> storeNumber;
- cout << "Enter payroll amount:$ ";
- cin >> store1;
- store1 += amount;
- }
- cout << endl;
- if (storeNumber == 2); // store 2
- {
- cout << "Enter a store number or -1 to end: ";
- cin >> storeNumber;
- cout << "Enter payroll amount:$ ";
- cin >> store2;
- store2 += amount;
- }
- cout << endl;
- if (storeNumber == 3); //store 3
- {
- cout << "Enter a store number or -1 to end: ";
- cin >> storeNumber;
- cout << "Enter payroll amount:$ ";
- cin >> store3;
- store3 += amount;
- }
- cout << endl;
- cout << "Enter a store number or -1 to end: ";
- cin >> storeNumber;
- }
- cout << endl;
- //print
- cout << "Store 1 payroll is :$ " << store1 << endl;
- cout << "Store 2 payroll is :$ " << store2 << endl;
- cout << "Store 3 payroll is :$ " << store3 << endl;
- cout << "Total payroll is : $ " << total << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement