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

TOP

返回列表