返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     int n =1,blance=0;
  8.     re:
  9.        system("pause");
  10.         int a=0,b=0,c=0,d=0,r,option,buyin =0;
  11.     cout<<"日本東京競馬場<東京優駿>[2400m草地]"<<endl;
  12.     cout<< "----------------------------------------------------------------------|goal"<<endl;
  13.      cout<<"◆"<<endl;
  14.     cout<<"★"<<endl;
  15.     cout<<"▲"<<endl;
  16.     cout<<"●"<<endl;
  17.     cout<<endl;
  18.     cout<<"可用餘額:"<<blance<<"元" <<endl;
  19.     cout<<endl;
  20.     cout<<"(1)買入 (2)下注 (3)離開 請選擇:";
  21.     cin>>option;
  22.     if(option==1)
  23.     {
  24.                  cout<<"買入:";
  25.                  cin>>buyin;
  26.                  blance += buyin;
  27.     }
  28.     system("pause");
  29.     system("cls");
  30.     srand(time(NULL));
  31.     string words ="賽馬進行中";
  32.     string name[4] = {"◆","★","▲","●"};
  33.     int position =0;
  34.     while(a<=70 && b<=70 && c<=70 && d<=70)
  35.     {  
  36.       cout<<words<<endl;
  37.       cout<<"------------------------------------------------------------------------| 終點"<<endl;
  38.       r = rand()%4+1;
  39.       switch(r)
  40.       {
  41.           case 1:
  42.                a++;
  43.                break;
  44.           case 2:
  45.                b++;
  46.                break;
  47.           case 3:
  48.                c++;
  49.                break;
  50.           case 4:
  51.                d++;
  52.                break;
  53.       }
  54.       for(int i=0;i<=a;i++)
  55.       {
  56.           cout<<" ";
  57.       }
  58.       cout<<name[0]<<endl;
  59.       for(int i=0;i<=b;i++)
  60.       {
  61.           cout<<" ";
  62.       }
  63.       cout<<name[1]<<endl;
  64.       for(int i=0;i<=c;i++)
  65.       {
  66.           cout<<" ";
  67.       }
  68.       cout<<name[2]<<endl;
  69.       for(int i=0;i<=d;i++)
  70.       {
  71.           cout<<" ";
  72.       }
  73.       cout<<name[3]<<endl;
  74.       if(a==70 || b==70 || c==70 || d==70)
  75.       {
  76.          if(a==70)
  77.                   position = 0;
  78.          if(b==70)
  79.                   position = 1;
  80.          if(c==70)
  81.                   position = 2;
  82.          if(d==70)
  83.                   position = 3;
  84.          words = "比賽結束!由"+name[position]+"先馳得點!";
  85.       }
  86.       if(a==71 || b==71 || c==71 || d==71)
  87.       {      
  88.       }else{      
  89.         system("cls");
  90.       }
  91.       
  92.     }
  93.    
  94.     n++;
  95.     goto re;
  96.     return 0;   
  97. }
複製代碼

TOP

返回列表