- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- string food[]={"牛肉","雞肉","羊肉","魚肉","豬肉","狗肉","貓肉","人肉","馬肉"};
- cout<<"★☆★ 抽籤程式 ★☆★"<<endl;
- cout<<"今天晚餐\吃什麼?"<<endl;
- system("pause");
- for(int i=1; i<=50; i++)
- {
- if(i%2==1)
- {
- cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
- }else
- {
- cout<<"★☆★ 抽籤中 ★☆★"<<endl;
- }
- cout<<food[rand()%9]<<endl;
- system("cls");
- }
- cout<<"吃"<<food[rand()%9]<<"!"<<endl;
-
- system("pause");
- return 0;
- }
複製代碼 |