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

TOP

返回列表