返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int n=1;
  7.     re:
  8.     int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,z;
  9.     srand(time(NULL));
  10.     cout<<"1.Harry Poter    "<<endl;
  11.     cout<<"2.Ron Weasley    "<<endl;
  12.     cout<<"3.Cedric Diggory "<<endl;
  13.     cout<<"4.Draco Malfoy   "<<endl;
  14.     cout<<"5.Cho Chang      "<<endl;
  15.     cout<<"6.Fred Weasley   "<<endl;
  16.     cout<<"7.George Weasley "<<endl;
  17.     cout<<"8.Ginny Weasley  "<<endl;
  18.     system("pause");
  19.     system("cls");
  20.     cout<<"Broomstick fling a match of Hogwarts  #"<<n<<endl;
  21.     cout<<"--------------------------------------------------------------------|win"<<endl;
  22.     cout<<"1"<<endl;
  23.     cout<<"2"<<endl;
  24.     cout<<"3"<<endl;
  25.     cout<<"4"<<endl;
  26.     cout<<"5"<<endl;
  27.     cout<<"6"<<endl;
  28.     cout<<"7"<<endl;
  29.     cout<<"8"<<endl;
  30.     system("pause");
  31.     system("cls");
  32.     while(a<=65 && b<=65 && c<=65 && d<=65 && e<=65 && f<=65 && g<=65 && h<=65)
  33.     {
  34.       z=rand()%8+1;
  35.       if(z==1)   
  36.        a++;
  37.       else if(z==2)   
  38.        b++;
  39.       else if(z==3)   
  40.        c++;
  41.       else if(z==4)   
  42.        d++;
  43.       else if(z==5)   
  44.        e++;
  45.       else if(z==6)   
  46.        f++;
  47.       else if(z==7)   
  48.        g++;
  49.       else  
  50.        h++;
  51.       cout<<"RUN"<<endl;
  52.       cout<<"------------------------------------------------------------------|win"<<endl;
  53.       for(int i=0;i<=a;i++)
  54.         cout<<" ";
  55.       cout<<"1"<<endl;
  56.       for(int i=0;i<=b;i++)
  57.         cout<<" ";
  58.       cout<<"2"<<endl;
  59.       for(int i=0;i<=c;i++)
  60.         cout<<" ";
  61.       cout<<"3"<<endl;
  62.       for(int i=0;i<=d;i++)
  63.         cout<<" ";
  64.       cout<<"4"<<endl;
  65.       for(int i=0;i<=e;i++)
  66.         cout<<" ";
  67.       cout<<"5"<<endl;
  68.       for(int i=0;i<=f;i++)
  69.         cout<<" ";
  70.       cout<<"6"<<endl;
  71.       for(int i=0;i<=g;i++)
  72.         cout<<" ";
  73.       cout<<"7"<<endl;
  74.       for(int i=0;i<=h;i++)
  75.         cout<<" ";
  76.       cout<<"8"<<endl;
  77.       system("cls");
  78.     }
  79.     cout<<"over"<<endl;
  80.     cout<<"--------------------------------------------------------------------|win"<<endl;
  81.     for(int i=0;i<=a;i++)
  82.       cout<<" ";
  83.     cout<<"1"<<endl;
  84.     for(int i=0;i<=b;i++)
  85.       cout<<" ";
  86.     cout<<"2"<<endl;
  87.     for(int i=0;i<=c;i++)
  88.       cout<<" ";
  89.     cout<<"3"<<endl;
  90.     for(int i=0;i<=d;i++)
  91.       cout<<" ";
  92.     cout<<"4"<<endl;
  93.     for(int i=0;i<=e;i++)
  94.       cout<<" ";
  95.     cout<<"5"<<endl;
  96.     for(int i=0;i<=f;i++)
  97.       cout<<" ";
  98.     cout<<"6"<<endl;
  99.     for(int i=0;i<=g;i++)
  100.       cout<<" ";
  101.     cout<<"7"<<endl;
  102.     for(int i=0;i<=h;i++)
  103.       cout<<" ";
  104.     cout<<"8"<<endl;
  105.     if(a==65)
  106.       cout<<"Harry Poter  win"<<endl;
  107.     else if(b==65)
  108.       cout<<"Ron Weasley   win"<<endl;
  109.     else if(c==65)
  110.       cout<<"Cedric Diggory  win"<<endl;
  111.     else if(d==65)
  112.       cout<<"Draco Malfoy win"<<endl;
  113.     else if(e==65)
  114.       cout<<"Cho Chang    win"<<endl;
  115.     else if(f==65)
  116.       cout<<"Fred Weasley  win"<<endl;
  117.     else if(g==65)
  118.       cout<<"George Weasley  win"<<endl;
  119.     else
  120.       cout<<"Ginny Weasley win"<<endl;  

  121.     n++;
  122.     system("pause");
  123.     goto re;
  124.     return 0;
  125. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int n=1;
  7.     re:
  8.     system("cls");
  9.     int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,z;
  10.     srand(time(NULL));
  11.     cout<<"1.Harry Poter    "<<endl;
  12.     cout<<"2.Ron Weasley    "<<endl;
  13.     cout<<"3.Cedric Diggory "<<endl;
  14.     cout<<"4.Draco Malfoy   "<<endl;
  15.     cout<<"5.Cho Chang      "<<endl;
  16.     cout<<"6.Fred Weasley   "<<endl;
  17.     cout<<"7.George Weasley "<<endl;
  18.     cout<<"8.Ginny Weasley  "<<endl;
  19.     system("pause");
  20.     system("cls");
  21.     cout<<"Broomstick fling a match of Hogwarts  #"<<n<<endl;
  22.     cout<<"--------------------------------------------------------------------|win"<<endl;
  23.     cout<<"1"<<endl;
  24.     cout<<"2"<<endl;
  25.     cout<<"3"<<endl;
  26.     cout<<"4"<<endl;
  27.     cout<<"5"<<endl;
  28.     cout<<"6"<<endl;
  29.     cout<<"7"<<endl;
  30.     cout<<"8"<<endl;
  31.     system("pause");
  32.     system("cls");
  33.     while(a<=65 && b<=65 && c<=65 && d<=65 && e<=65 && f<=65 && g<=65 && h<=65)
  34.     {
  35.       z=rand()%8+1;
  36.       if(z==1)   
  37.        a++;
  38.       else if(z==2)   
  39.        b++;
  40.       else if(z==3)   
  41.        c++;
  42.       else if(z==4)   
  43.        d++;
  44.       else if(z==5)   
  45.        e++;
  46.       else if(z==6)   
  47.        f++;
  48.       else if(z==7)   
  49.        g++;
  50.       else  
  51.        h++;
  52.       cout<<"RUNNING"<<endl;
  53.       cout<<"------------------------------------------------------------------|win"<<endl;
  54.       for(int i=0;i<=a;i++)
  55.         cout<<" ";
  56.       cout<<"1"<<endl;
  57.       for(int i=0;i<=b;i++)
  58.         cout<<" ";
  59.       cout<<"2"<<endl;
  60.       for(int i=0;i<=c;i++)
  61.         cout<<" ";
  62.       cout<<"3"<<endl;
  63.       for(int i=0;i<=d;i++)
  64.         cout<<" ";
  65.       cout<<"4"<<endl;
  66.       for(int i=0;i<=e;i++)
  67.         cout<<" ";
  68.       cout<<"5"<<endl;
  69.       for(int i=0;i<=f;i++)
  70.         cout<<" ";
  71.       cout<<"6"<<endl;
  72.       for(int i=0;i<=g;i++)
  73.         cout<<" ";
  74.       cout<<"7"<<endl;
  75.       for(int i=0;i<=h;i++)
  76.         cout<<" ";
  77.       cout<<"8"<<endl;
  78.       system("cls");
  79.     }
  80.     cout<<"over"<<endl;
  81.     cout<<"--------------------------------------------------------------------|win"<<endl;
  82.     for(int i=0;i<=a;i++)
  83.       cout<<" ";
  84.     cout<<"1"<<endl;
  85.     for(int i=0;i<=b;i++)
  86.       cout<<" ";
  87.     cout<<"2"<<endl;
  88.     for(int i=0;i<=c;i++)
  89.       cout<<" ";
  90.     cout<<"3"<<endl;
  91.     for(int i=0;i<=d;i++)
  92.       cout<<" ";
  93.     cout<<"4"<<endl;
  94.     for(int i=0;i<=e;i++)
  95.       cout<<" ";
  96.     cout<<"5"<<endl;
  97.     for(int i=0;i<=f;i++)
  98.       cout<<" ";
  99.     cout<<"6"<<endl;
  100.     for(int i=0;i<=g;i++)
  101.       cout<<" ";
  102.     cout<<"7"<<endl;
  103.     for(int i=0;i<=h;i++)
  104.       cout<<" ";
  105.     cout<<"8"<<endl;
  106.     if(a==66)
  107.       cout<<"Harry Poter     win"<<endl;
  108.     else if(b==66)
  109.       cout<<"Ron Weasley     win"<<endl;
  110.     else if(c==66)
  111.       cout<<"Cedric Diggory  win"<<endl;
  112.     else if(d==66)
  113.       cout<<"Draco Malfoy    win"<<endl;
  114.     else if(e==66)
  115.       cout<<"Cho Chang       win"<<endl;
  116.     else if(f==66)
  117.       cout<<"Fred Weasley    win"<<endl;
  118.     else if(g==66)
  119.       cout<<"George Weasley  win"<<endl;
  120.     else
  121.       cout<<"Ginny Weasley   win"<<endl;  

  122.     n++;
  123.     system("pause");
  124.     goto re;
  125.     return 0;
  126. }
複製代碼

TOP

返回列表