返回列表 發帖
本帖最後由 何權晉 於 2023-7-7 21:04 編輯
  1. #include<iostream>
  2. #include<ctime>
  3. using namespace std;
  4. int main()
  5. {
  6.     int r=1;
  7.     re:
  8.         
  9.     int s[]={0,0,0,0};
  10.     string h[]={"◆","★","▲","●"};
  11.     srand(time(NULL));
  12.     cout<<"Round "<<r<<endl;
  13.     cout<<"★★★The Wetherby Racecourse★★★"<<endl;
  14. cout<<"-------------------------------------------------------------------------|Finish"<<endl;
  15.     for(int i=0;i<=3;i++)
  16.     cout<<h[i]<<endl;
  17.     system("pause");
  18. while(true)
  19. {
  20.     system("cls");
  21.     int o=rand()%4;
  22.     s[o]++;
  23.     cout<<"Round "<<r<<endl;
  24.     cout<<"★★★The Wetherby Racecourse★★★"<<endl;
  25.      cout<<"-------------------------------------------------------------------------|Finish"<<endl;
  26.       for(int i=0; i<4; i++)
  27.         {
  28.             for(int j=0; j<s[i]; j++)
  29.             {
  30.                 cout<<" ";  
  31.                 }   
  32.                 cout<<h[i]<<endl;   
  33.         }
  34.          
  35.     if (s[o]==73)
  36.     break;
  37.     _sleep(50);
  38. }
  39. system("cls");
  40. cout<<"Race Finished"<<endl;
  41. cout<<"Round "<<r<<endl;
  42. cout<<"★★★The Wetherby Racecourse★★★"<<endl;
  43. cout<<"-------------------------------------------------------------------------|Finish"<<endl;

  44. for(int i=0; i<4; i++)
  45.         {
  46.             for(int j=0; j<s[i]; j++)
  47.             {
  48.                 cout<<" ";  
  49.                 }   
  50.                 cout<<h[i]<<endl;   
  51.         }
  52.          
  53. for(int i=0;i<=3;i++)
  54.         {
  55.                 if(s[i]==73)
  56.                 {
  57.                             cout<<h[i]<<" Won The Race"<<endl;
  58.                             }
  59.                             }

  60.           r++;
  61.           goto re;
  62.          
  63. system("pause");
  64. return 0;
  65. }
複製代碼

TOP

返回列表