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

TOP

返回列表