🔒 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
  • 352
    Views
  • 2
    Participants
Last reply from:
Slime-

Online now

Members online
808
Guests online
1,372
Total visitors
2,180

Forum statistics

Threads
2,275,062
Posts
28,960,363
Members
1,233,552
Latest member
dphuong088
Back
Top