返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     cout<<"「好事成雙」賽馬場"<<endl;
  8.     cout<<"------------------------------------------------------------------------| 終點"<<endl;
  9.     cout<<"◆"<<endl;
  10.     cout<<"★"<<endl;
  11.     cout<<"▲"<<endl;
  12.     cout<<"●"<<endl;
  13.     system("pause");
  14.     system("cls");
  15.     srand(time(NULL));

  16.     int a=0,b=0,c=0,d=0,r;
  17.    
  18.     string words ="賽馬進行中";
  19.     while(a<=70 && b<=70 && c<=70 && d<=70)
  20.     {  
  21.       cout<<words<<endl;
  22.       cout<<"------------------------------------------------------------------------| 終點"<<endl;   
  23.       
  24.       r = rand()%4+1;
  25.    
  26.       switch(r)
  27.       {
  28.           case 1:
  29.                a++;
  30.                break;
  31.           case 2:
  32.                b++;
  33.                break;
  34.           case 3:
  35.                c++;
  36.                break;
  37.           case 4:
  38.                d++;
  39.                break;
  40.       }
  41.       
  42.       
  43.    
  44.       for(int i=0;i<=a;i++)
  45.       {
  46.           cout<<" ";
  47.       }
  48.       cout<<"◆"<<endl;
  49.    
  50.       for(int i=0;i<=b;i++)
  51.       {
  52.           cout<<" ";
  53.       }
  54.       cout<<"★"<<endl;
  55.       
  56.       
  57.       for(int i=0;i<=c;i++)
  58.       {
  59.           cout<<" ";
  60.       }
  61.       cout<<"▲"<<endl;
  62.       
  63.       
  64.       for(int i=0;i<=d;i++)
  65.       {
  66.           cout<<" ";
  67.       }
  68.       cout<<"●"<<endl;
  69.       
  70.       if(a==70 || b==70 || c==70 || d==70)
  71.       {
  72.          words = "賽馬完成";
  73.       }
  74.       
  75.       if(a==71 || b==71 || c==71 || d==71)
  76.       {      
  77.       }else{      
  78.         system("cls");
  79.       }
  80.       
  81.     }
  82.       
  83.     system("pause");
  84.     return 0;   
  85. }
複製代碼

TOP

返回列表