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

TOP

返回列表