返回列表 發帖
  1. #include<iostream>
  2. #include<ctime>
  3. using namespace std;
  4. int main()
  5. {
  6.     int r=1;
  7.     int op;
  8.     int pur;
  9.     int bal=0;   
  10.     re:
  11.     int s[]={0,0,0,0};
  12.     string h[]={"◆","★","▲","●"};
  13.     srand(time(NULL));
  14.     cout<<endl<<endl;
  15.     cout<<"Round "<<r<<endl;
  16.     cout<<"★★★The Wetherby Racecourse★★★"<<endl;
  17. cout<<"-------------------------------------------------------------------------|Finish"<<endl;
  18.    for(int i=0;i<=3;i++)
  19.     cout<<h[i]<<endl;
  20.     cout<<endl<<"Balance: $"<<bal<<endl<<endl;
  21.     cout<<"(1)Deposit (2) Place Bid (3)Return to main menu"<<endl;
  22.     cout<<"Enter option: ";
  23.     cin>>op;
  24.       if(op==1){
  25.          
  26.             cout<<"Deposit Amount: ";
  27.             cin>>pur;
  28.             bal=bal+pur;        
  29.             goto re;
  30.         }
  31.     system("pause");
  32. while(true)
  33. {
  34.     system("cls");
  35.     int o=rand()%4;
  36.     s[o]++;
  37.     cout<<"Round "<<r<<endl;
  38.     cout<<"★★★The Wetherby Racecourse★★★"<<endl;
  39.      cout<<"-------------------------------------------------------------------------|Finish"<<endl;
  40.       for(int i=0; i<4; i++)
  41.         {
  42.             for(int j=0; j<s[i]; j++)
  43.             {
  44.                 cout<<" ";  
  45.                 }   
  46.                 cout<<h[i]<<endl;   
  47.         }
  48.          
  49.     if (s[o]==73)
  50.     break;
  51.     _sleep(50);
  52. }
  53. system("cls");
  54. cout<<"Race Finished"<<endl;
  55. cout<<"Round "<<r<<endl;
  56. cout<<"★★★The Wetherby Racecourse★★★"<<endl;
  57. cout<<"-------------------------------------------------------------------------|Finish"<<endl;

  58. for(int i=0; i<4; i++)
  59.         {
  60.             for(int j=0; j<s[i]; j++)
  61.             {
  62.                 cout<<" ";  
  63.                 }   
  64.                 cout<<h[i]<<endl;   
  65.         }
  66.          
  67. for(int i=0;i<=3;i++)
  68.         {
  69.                 if(s[i]==73)
  70.                 {
  71.                             cout<<h[i]<<" Won The Race"<<endl;
  72.                             }
  73.                             }

  74.           r++;
  75.           goto re;
  76.          
  77. system("pause");
  78. return 0;
  79. }
複製代碼

TOP

返回列表