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



  28.     system("pause");
  29.     return 0;
  30. }
複製代碼

TOP

返回列表