So I am writing a cash register program, person buys items and the number calculates. But I am stuck at looping, I want the user to pick to pick all his/her items first then after all the program is done I want the program to ask if the user wants to runt he program again. I am really stuck at these points. Picking items and looping. so far I got.
#include <iostream>
using namespace std;
int main()
{
char Jeans = 60, a ;
char WhiteTshirt=10;
char Socks= 15;
char Sneakers=80;
char Checkout;
int Choice;
int total;
int b;
int c;
int d;
cout <<"What would you like to purchase? \n";
cout <<"1. Jeans $60.00 \n";
cout <<"2. White T-shirt $10.00 \n";
cout <<"3. Socks $15.00 \n";
cout <<"4. Sneakers $80.00 \n";
cout <<"5. Checkout \n";
cout <<"What would you like to do? \n";
cin >> Choice;
{
if(Choice == 1)
{
cout <<"How many Jeans would you like to purchase? \n";
cin >> a;
cout <<"Purchases = " << a << endl;
total = Jeans * a;
cout <<"Price =$" << total << endl;
}
else if(Choice == 2)
{
cout <<"How many White T-shirts would you like to purchase? \n";
cin >> b;
total = WhiteTshirt * b;
cout <<"Price =$" << total << endl;
}
else if(Choice == 3)
{
cout <<"How many Socks would you like to purchase? \n";
cin >> c;
total = Socks * c;
cout <<"Price =$" << total << endl;
}
else if(Choice == 4)
{
cout <<"How many Sneakers would you like to purchse? \n";
cin >> d;
total = Sneakers * d;
cout <<"Price =$" << total << endl;
}
else if(Choice == 5)
{
cout <<"Would you like to Checkout? \n";
cin >> Checkout;
total = 1 + 2 + 3 + 4;
cout <<"Your total comes to =$" << total << endl;
}
}
return 0;
}
So how do I make the user pick all his/her items firt before calculating, and looping program asking the user if he/she wants to run it again.