返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<time.h>
  4. using namespace std;
  5. int main()
  6. {
  7.     srand(time(NULL));
  8.     int supper=0;
  9.     string food[]={"米飯",
  10.                    "麵包",
  11.                    "蛋糕","餅乾","饅頭","麵條","玉米","蕃薯","芋頭","糖果"};
  12.     supper=(rand()%(10-1+1)+1);
  13.     cout<<"吃"<<food[supper+1]<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

返回列表