返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int player,computer;
  7.     string go[3]={"剪刀","石頭","布"};
  8.     cout<<"請出拳! (1)"+go[0]+"(2)"+go[1]+"(3)"+go[2]+":";
  9.     cin>>player;
  10.     cout<<"你出"+go[player-1]+"!"<<endl;
  11.     srand(time(NULL));
  12.     computer=rand()%3+1;
  13.     cout<<"電腦"+go[computer-1]+"!"<<endl;
  14.     system("pause");   
  15.     return 0;
  16. }
複製代碼

TOP

返回列表