Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // michael freeland 5.17
- #include <iostream>
- using namespace std;
- int main() {
- int change = 0;
- long double total{ 0 };
- int count{ 0 };
- int loop{ 0 };
- float total = 0;
- while (loop != 2)
- {
- cout << "Chose 1 through 5 to select the product you want." << endl;
- cout << "To stop selecting products select 0" << endl;
- cin >> change;
- switch (change) {
- case 1:
- total += total + 2.98f;
- count++;
- break;
- case 2:
- total += total + 4.50f;
- count++;
- break;
- case 3:
- total = total + 9.98f;
- count++;
- break;
- case 4:
- total = total + 4.49f;
- count++;
- break;
- case 5:
- total = total + 6.87f;
- count++;
- break;
- default:
- cout << "you did not select a valid product." << endl;
- }
- cout << "Current total: $" << total << endl;
- cout << "Total Items: " << count << endl;
- cout << "To add more products press 1" << endl;
- cout << "To stop shopping press 2" << endl;
- cin >> loop;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement