🔒 Closed Automatically rename a user input code to a specific name according to menu list c++

Status
Not open for further replies.

IkaMusume

Forum Guru
Paano po irename automatically yung mga na input na meal codes to specific name

parang ganito kumware nag input si user ng S1 tapos ganito ang lalabas na output

Code:
Summary of Order

1 * 5.00 Burger

here's the code

C++:
//Meal code s1 is burger

//meal code s2 is pizza



    cout << "\tHow many meal codes?: ";

    cin >> u_code_num;

    

    for (int i=0; i<u_code_num; i++)

    {

        cin.ignore();

        cout << "Meal Code: ";

        cin >> u_code[i];

        if (u_code[i] == "s1")

        {

            strcpy(meal_ordered, "Burger");

            meal_price = 5.00;

        }

        else if (u_code[i] == "s2")

        {

            strcpy(meal_ordered, "Pizza");

            meal_price = 6.00;

        }

        else

        {

            cout << "Meal code doesn't exist!"

        }

    }

    cout << "Customer Name: " << cust_name << endl;

    cout << "Customer Address: " << cust_add << endl;

    cout << "Customer Contact Number: " << cust_num << endl;
    cout << "Summary of Order\n";
    for (int i=0; i<u_code_num; i++)
    {
        cout << i << meal_ordered << meal_price;

        cout << "\n";
    }
 
Di mo pa na try paps dun sa if else mo na ucode == x, na lagyan ng variable sample meal[1] == "Burger".

Then display mo yung meals?
 
Status
Not open for further replies.

About this Thread

  • 1
    Replies
  • 374
    Views
  • 2
    Participants
Last reply from:
Slime-

Trending Topics

Online now

Members online
382
Guests online
3,897
Total visitors
4,279

Forum statistics

Threads
2,308,630
Posts
29,186,303
Members
1,192,123
Latest member
nigatron321
Back
Top