返回列表 發帖
本帖最後由 陳泓瑜 於 2016-10-29 11:11 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     srand(time(NULL));
  8.     re:
  9.     system("cls");
  10.     int a=0,b=0,c=0,d=0;
  11.     cout<<"狗屁'賽'馬場"<<endl;
  12.     cout<<"-------------------------------------------------------------------------|FINISH";
  13.     cout<<"1"<<endl;
  14.     cout<<"2"<<endl;
  15.     cout<<"3"<<endl;
  16.     cout<<"4"<<endl;
  17.     system("pause");
  18.     system("cls");
  19.     while(a!=74 && b!=74 && c!=74 && d!=74)
  20.     {
  21.         int r=rand()%4;   //0~3
  22.         if(r==0)
  23.             a++;
  24.         else if(r==1)
  25.             b++;
  26.         else if(r==2)
  27.             c++;
  28.         else
  29.             d++;
  30.         cout<<"開始放屁中"<<endl;
  31.         cout<<"-------------------------------------------------------------------------|FINISH";
  32.         for(int i=0; i<a; i++)
  33.             cout<<"_";
  34.         cout<<"1"<<endl;   
  35.         for(int i=0; i<b; i++)
  36.             cout<<"_";
  37.         cout<<"2"<<endl;
  38.         for(int i=0; i<c; i++)
  39.             cout<<"_";
  40.         cout<<"3"<<endl;
  41.         for(int i=0; i<d; i++)
  42.             cout<<"_";
  43.         cout<<"4"<<endl;     
  44.         system("cls");
  45.     }
  46.    
  47.        cout<<"GAME OVER!!"<<endl;
  48.        cout<<"-------------------------------------------------------------------------|FINISH";
  49.        for(int i=0; i<a; i++)
  50.             cout<<"_";
  51.         cout<<"1"<<endl;   
  52.         for(int i=0; i<b; i++)
  53.             cout<<"_";
  54.         cout<<"2"<<endl;
  55.         for(int i=0; i<c; i++)
  56.             cout<<"_";
  57.         cout<<"3"<<endl;
  58.         for(int i=0; i<d; i++)
  59.             cout<<"_";
  60.         cout<<"4"<<endl;
  61.      
  62.     system("pause");
  63.     goto re;
  64.     return 0;
  65. }
複製代碼

TOP

返回列表