返回列表 發帖
  1.     #include<iostream>
  2.     #include<cstdlib>
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         re:
  7.         srand(time(NULL));
  8.         int x,z;
  9.         cout<<"請出拳! (1)剪刀(2)石頭(3)布 ";
  10.         cin>>x;
  11.         z=rand()%3+1;
  12.         cout<<"你出";
  13.         if(x==1)
  14.             cout<<"剪刀!"<<endl;
  15.         else if(x==2)
  16.             cout<<"石頭!"<<endl;
  17.         else
  18.             cout<<"布!"<<endl;
  19.         cout<<"電腦出";
  20.         if(z==1)
  21.             cout<<"剪刀!"<<endl;
  22.         else if(z==2)
  23.             cout<<"石頭!"<<endl;
  24.         else
  25.             cout<<"布!"<<endl;
  26.         goto re;
  27.         system("pause");   
  28.         return 0;
  29.     }
複製代碼

TOP

返回列表