Im trying to figure out how to error trap this program so if the user doesnt put in a valid response then a message will cum up and they will go back 2 the beginning until they do it correctly.

also i want to subtract the money they spend and tell them their remaining amount, also i want to keep track of the number of items they purchase.

when i do it all that comes up is a whole bunch of numbers.
can anyone help when you compile this program i want this format but the numbers arent right

can anyone help?

/* SIUE's bookstore is having aspecail sale on tiems embossed with the cougar logo. For a limited time, three items, mugs, teeshirts, and pens
 are offered at a reduced rate with tax included to simplify the sales. Mugs are going for $2.50, teeshirts for $9.50 and pens for 75
 cents. Coincidentally, your parents (or spouse, friend, coworker, or other person you know off-campus) just gave you $30.00 to buy SIUE
 stuff for them.*/

 #include<iostream>
 using namespace std;
 int main()
 {
    char symb;
    int item_purch, numb_item_purch, quit;
    double mug, teeshirt, pen, tot_mon, curr_cash, mon_spent;

    cout << "What do you want to buy today?\n";
    cout << "You have 30 dollars to spend.\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;


        switch (symb)
        {
            case 'A':;
            case 'a':;
            cout << " You have choosen A) mugs for $2.50 \n";
            mug = 2.50;
            cout << " You have " << curr_cash << " remaining \n ";
            tot_mon = 30;
            curr_cash = tot_mon - mug;
            cout << " You have purchased " << numb_item_purch << " today \n ";
            numb_item_purch = item_purch + 1;
            break;
            case 'B':;
            case 'b':;
            cout << " You have choosen B) teeshirt for $9.50 ";
            teeshirt = 9.50;
            break;
            case 'C':;
            case 'c':;
            cout << " You have choosen C) Pens for .75 cents ";
            pen = .75;
            break;
            case 'D':;
            case 'd':;
            cout << " You have choosen D) which means you want to Quit" << endl;
            quit = 0;
            break;
        }



            cin >> tot_mon;
            curr_cash = tot_mon - mon_spent;
            cin >> curr_cash;
            cin >> mon_spent;




    return 0;
 }

Edited 3 Years Ago by Nick Evan: Fixed formatting

I'll give you the benefit of time this time. You received an infraction warning about CODE tags 7 minutes before posting this. Last warning.

I'll give you the benefit of time this time. You received an infraction warning about CODE tags 7 minutes before posting this. Last warning.

what are the code tags ? i will put them on there if i knew how an error comes up when i do it. arent they just codes for people too type in so when someone to help people they use the code tags? r am i wrong?
just let me know cuz this site is pimp it helps me out alot

You need to follow the rules, bro and use code tags otherwise majority of the folks here won't help you, except those who break rules like u just did.

what are the code tags ? i will put them on there if i knew how an error comes up when i do it. arent they just codes for people too type in so when someone to help people they use the code tags? r am i wrong?
just let me know cuz this site is pimp it helps me out alot

When you're writing a post, take a look at the bar on top where some cotrols for easy readability are placed. You would see something like this mong them:

                     (CODE)

Click on it, then something like this would appear:

[QUOTE][CODE][/CODE][/QUOTE]

Then, type your code in between them and that's it!

Edited 3 Years Ago by mike_2000_17: Fixed formatting

what are the code tags ? i will put them on there if i knew how an error comes up when i do it. arent they just codes for people too type in so when someone to help people they use the code tags? r am i wrong?
just let me know cuz this site is pimp it helps me out alot

Read your PM.

This question has already been answered. Start a new discussion instead.