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

TOP

返回列表