返回列表 發帖
  1.     #include<iostream>
  2.     #include<cstdlib>
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         re:
  7.           int x, z;
  8.     string meth[3]= {"剪刀", "石頭", "布"};
  9.     cout<<"請出拳! (1)"+meth[0]+" (2)"+meth[1]+" (3)"+meth[2]+": ";

  10.     cin>>x;
  11.     cout<<"你出"+meth[x-1]+"!"<<endl;
  12.     srand(time(NULL));
  13.     z = rand()%3+1;   
  14.     cout<<"電腦"+meth[z-1]+"!"<<endl;
  15.         goto re;
  16.         system("pause");   
  17.         return 0;
  18.     }
複製代碼

TOP

返回列表