#include<stdio.h>//c
#include<iostream>//c++
#include<time.h>//time() head
#include<iomanip>//setw() head
#include<stdlib.h>//rand() and srand() head
using namespace std;//cout and cin before
void Apartment();
void West();
void East();
void Out();
void two();
void Over();
void Select();
void Main();
void Apartment()
{
const char* Apartment[] = { "1楼","2楼","3楼" };
const char* OneFloor[] = { "桂林米粉","豚骨面" };
const char* TwoFloor[] = { "快餐","烤盘饭","干锅饭","小酥肉饭系列","拌饭","鸡排饭" };
const char* ThreeFloor[] = { "三师兄自选菜","石锅饭","麻辣香锅","黄焖鸡米饭" };
int n;
cout << "系统自动为你选择的楼层为:" << endl;
srand((unsigned)time(NULL));
n = rand() % 3 + 1;
cout << Apartment[n - 1] << endl;
cout << "系统为你选择该楼层的食品为:" << endl;
switch (n)
{
case 1:
cout << OneFloor[rand() % 1 + 0] << endl;
break;
case 2:
cout << TwoFloor[rand() % 6 + 0] << endl;
break;
case 3:
cout << ThreeFloor[rand() % 3 + 0] << endl;
break;
}
Over();
}
void East()
{
cout << "wait~" << endl;
Over();
}
void West()
{
cout << "wait~" << endl;
Over();
}
void Out()
{
cout << "wait~" << endl;
Over();
}
void two()
{
const char* Where[] = { "东院食堂","学生公寓食堂","西院食堂","去外面吃" };
int n;
cout << "系统为你选择的地点为:" << endl;
srand((unsigned)time(NULL));
n = rand() % 4 + 1;
cout << Where[n - 1] << endl;
switch (n)
{
case 1:
East();
break;
case 2:
Apartment();
break;
case 3:
West();
break;
case 4:
Out();
break;
}
}
void Main()
{
int n;
cout << "1.学生公寓食堂模式(适用于喜欢宅的uu们)" << endl;
cout << "2.全餐厅模式(可以排到公寓区以外的美食哦)" << endl;
cout << "3,Select" << endl;
cin >> n;
switch (n)
{
case 1:
cout << "" << endl;
Apartment();
break;
case 2:
cout << "" << endl;
two();
break;
case 3:
Select();
break;
}
}
void Over()
{
cout << endl << "选餐完毕";
Select();
}
void Select()
{
int n;
cout << "是否确认退出系统" << endl;
cout << "1.确认" << endl;
cout << "2.取消" << endl;
cin >> n;
switch (n)
{
case 2:cout << endl << "欢迎回到选餐系统 " << endl; ;
Main();
break;
case 1:cout << "退出成功,欢迎下次登录" << endl;
break;
}
cout << "" << endl;
}
int main()
{
int n;
cout << "Welcome to 义杰 meal selection system!" << endl << "This system is suitable for undergraduate and graduate students studying at Tianjin University of Finance and Economics, etc..." << endl << "If you are just a tourist and want to eat at Tianjin University of Finance and Economics, you can also choose this system, this system welcomes anyone!" << endl;
cout << "Please select a mode:" << endl;
Main();
return 0;
}
运行结果如下
因为本系统初衷是为了本人宿舍的成员使用,故菜品上只有我们宿舍爱吃的,而除了学生公寓餐厅其他的餐厅我们宿舍不去,所以没花时间做,代码显示都是wait~
所以,敬请期待!!!!