返回列表 發帖
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    re:
    int option;
    cout<<"請輸入您要的餐點? 1、咖啡 2、牛奶 3、紅茶";
    cin>>option;
    switch(option)
    {
        case 1:
            cout<<"您選擇的是咖啡"<<endl;
            break;
        case 2:
            cout<<"您選擇的是牛奶"<<endl;
            break;
        case 3:
            cout<<"您選擇的是紅茶"<<endl;
            break;
        default:
            cout<<"輸入錯誤"<<endl;

    }
    cout<<endl;
    goto re;
    system("pause");
    return 0;
}

TOP

返回列表