switch...case
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
int num = 0;
cout << "请输入1-7的一个整数:";
cin >> num;
switch (num)
{
case 1:
cout << "星期一:包子" << endl;
break;
case 2:
cout << "星期二:大米" << endl;
break;
case 3:
cout << "星期三:面条" << endl;
break;
case4:
cout << "星期四:玉米" << endl;
break;
case 5:
cout << "星期五:南瓜" << endl;
break;
case 6:
case 7:
cout << "周末,休息" << endl;
break;
default:
cout << "输入有误" << endl;
break;
}
system("pause");
return 0;
}