本帖最後由 章幼莛 於 2019-3-30 14:27 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int a;
- cout<<"☆★☆抽籤程式☆★☆"<<endl;
- cout<<"今晚吃什麼?"<<endl;
- string food[5]={"炒飯","炒麵","意麵","煎餃","滷味"};
- system("pause");
- system("cls");
- srand(time(NULL));
- for(int i=1;i<=100;i++)
- {
- a=rand()%5;
- if(i%2==0)
- {
- cout<<"☆★☆抽籤中☆★☆"<<endl;
- }else
- {
- cout<<"★☆★抽籤中★☆★"<<endl;
- }
- cout<<food[a]<<endl;
- system("cls");
- }
- cout<<"今天晚上選的食物是:"<<food[a]<<endl;
- system("pause");
- return 0;
- }
複製代碼 |