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

TOP

返回列表