ok how will i keep track of the items i bought? i have not the slightest clue on that. i dont even know where to start.
can someone point me in the right direction?
#include<iostream>
using namespace std;
int main()
{
char symb;
int item_purch, numb_item_purch, quit,;
double mug = 2.50f, teeshirt = 9.50f, pen= 0.75f,tot_mon = 30.0f;
cout << "You have 30 dollars to spend.\n";
do
{
cout << endl;
cout << "What do you want to buy today?\n";
cout << " A) Mugs $2.50 " << endl;
cout << " B) teeshirt $9.50 " << endl;
cout << " C) Pens .75 cents " << endl;
cout << " D) Quit" << endl;
cout << " Enter your letter and press Return when finished" << endl;
cin >> symb;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
switch (symb)
{
case 'A':;
case 'a':;
cout << " You have choosen A) mugs for $2.50 \n" << endl;
tot_mon -= mug;
cout << " You have " << tot_mon << " remaining \n" << endl;
break;
case 'B':;
case 'b':;
cout << " You have choosen B) teeshirt for $9.50 " << endl;
tot_mon -= teeshirt;
cout << " You have " << tot_mon << " remaining \n " << endl;
break;
case 'C':;
case 'c':;
cout << " You have choosen C) Pens for .75 cents " << endl;
tot_mon -= pen;
cout << " You have " << tot_mon << " remaining \n " << endl;
break;
case 'D':;
case 'd':;
cout << " You have choosen D) which means you want to Quit" << endl;
tot_mon = 0;
break;
default:
cout << "Input error. Select again" << endl;
}
if ( tot_mon == 0.0f )
cout << "You need more cash, you dont have enough\n" << endl;
else
cout << " Would you like anothe purchase, please choose another letter.\n" << endl;
} while ( tot_mon >= 0.0f );
{
cout << "Thank you for shopping.\n";
}
return 0;
}