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

TOP

返回列表