返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     cout<<"日本東京競馬場<東京優駿>[2400m草地]"<<endl;
  8.     cout<< "----------------------------------------------------------------------|goal"<<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.     while(a<=70 && b<=70 && c<=70 && d<=70)
  18.     {  
  19.       cout<<"賽馬進行中"<<endl;
  20.       cout<<"------------------------------------------------------------------------| 終點"<<endl;   
  21.       r = rand()%4+1;
  22.       switch(r)
  23.       {
  24.           case 1:
  25.                a++;
  26.                break;
  27.           case 2:
  28.                b++;
  29.                break;
  30.           case 3:
  31.                c++;
  32.                break;
  33.           case 4:
  34.                d++;
  35.                break;
  36.       }
  37.       for(int i=0;i<=a;i++)
  38.       {
  39.           cout<<" ";
  40.       }
  41.       cout<<"◆"<<endl;
  42.       for(int i=0;i<=b;i++)
  43.       {
  44.           cout<<" ";
  45.       }
  46.       cout<<"★"<<endl;
  47.       for(int i=0;i<=c;i++)
  48.       {
  49.           cout<<" ";
  50.       }
  51.       cout<<"▲"<<endl;
  52.       for(int i=0;i<=d;i++)
  53.       {
  54.           cout<<" ";
  55.       }
  56.       cout<<"●"<<endl;
  57.       system("cls");
  58.     }
  59.    
  60.     system("pause");
  61.     return 0;   
  62. }
複製代碼

TOP

返回列表