返回列表 發帖

跑馬燈 (三)

利用跑馬燈的方式, 顯示訊息 "歡迎光臨".
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:     
  7.     for(int i=1; i<=220; i++)
  8.     {   
  9.         if(i>=1 && i<=20)
  10.              cout<<"歡";
  11.         if(i>=21 && i<=40)
  12.              cout<<"  迎";
  13.         if(i>=41 && i<=60)
  14.              cout<<"    光";
  15.         if(i>=61 && i<=80)
  16.              cout<<"      臨";
  17.         if(i>=81 && i<=100)
  18.              cout<<"歡";
  19.         if(i>=101 && i<=120)
  20.              cout<<"歡迎";
  21.         if(i>=121 && i<=140)
  22.              cout<<"歡迎光";
  23.         if(i>=141 && i<=160)
  24.              cout<<"歡迎光臨";
  25.         if(i>=161 && i<=170)
  26.              cout<<" ";
  27.         if(i>=171 && i<=180)
  28.              cout<<"歡迎光臨";
  29.         if(i>=181 && i<=190)
  30.              cout<<" ";
  31.         if(i>=191 && i<=200)
  32.              cout<<"歡迎光臨";
  33.         if(i>=201 && i<=210)
  34.              cout<<" ";
  35.         if(i>=211 && i<=220)
  36.              cout<<"歡迎光臨";
  37.         system("cls");
  38.     }
  39.     goto re;
  40.     system("pause");   
  41.     return 0;
  42. }
複製代碼

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     for(int i=1;i<=14;i++)
  8.     {
  9.          if(i==1)
  10.             cout<<"歡";
  11.          if(i==2)
  12.             cout<<"  迎";
  13.          if(i==3)
  14.             cout<<"    光";
  15.          if(i==4)
  16.             cout<<"       臨";
  17.          if(i==5)
  18.             cout<<"歡";
  19.          if(i==6)
  20.             cout<<"歡迎";
  21.          if(i==7)
  22.             cout<<"歡迎光";
  23.          if(i==8)
  24.             cout<<"歡迎光臨";
  25.          if(i==9)
  26.             cout<<"";
  27.          if(i==10)
  28.             cout<<"歡迎光臨";
  29.          if(i==11)
  30.             cout<<"";
  31.          if(i==12)
  32.             cout<<"歡迎光臨";
  33.          if(i==13)
  34.             cout<<"";
  35.          if(i==14)
  36.             cout<<"歡迎光臨";
  37.          _sleep(100);
  38.          system("cls");
  39.          
  40.     }
  41.     goto re;
  42.     system("pause");
  43.     return 0;
  44. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     for(int i=1; i<=14; i++)
  8.     {
  9.          if(i==1)
  10.              cout<<"歡"<<endl;
  11.          if(i==2)
  12.              cout<<"  迎"<<endl;
  13.          if(i==3)
  14.              cout<<"    光"<<endl;
  15.          if(i==4)
  16.              cout<<"      臨"<<endl;
  17.          if(i==5)
  18.              cout<<"歡"<<endl;
  19.          if(i==6)
  20.              cout<<"歡迎"<<endl;
  21.          if(i==7)
  22.              cout<<"歡迎光"<<endl;
  23.          if(i==8)
  24.              cout<<"歡迎光臨"<<endl;
  25.          if(i==9)
  26.              cout<<""<<endl;
  27.          if(i==10)
  28.              cout<<"歡迎光臨"<<endl;
  29.          if(i==11)
  30.              cout<<""<<endl;
  31.          if(i==12)
  32.              cout<<"歡迎光臨"<<endl;
  33.          if(i==13)
  34.              cout<<""<<endl;
  35.          if(i==14)
  36.              cout<<"歡迎光臨"<<endl;
  37.              _sleep(300);
  38.          system("cls");
  39.     }
  40.     goto re;
  41.     system("pause");
  42.     return 0;
  43. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         int tmp,a;
  7.         cout<<"請輸入變慢的倍率:";
  8.         cin>>a;
  9.         re:
  10.         for(int i=1;i<=220*a;i++)
  11.         {
  12.                 tmp=i/a;
  13.                 if(tmp>=1 && tmp<=20)
  14.                         cout<<"歡";
  15.                 if(tmp>=21 && tmp<=40)
  16.                         cout<<"  迎";
  17.                 if(tmp>=41 && tmp<=60)
  18.                         cout<<"    光";
  19.                 if(tmp>=61 && tmp<=80)
  20.                         cout<<"      臨";
  21.                 if(tmp>=81 && tmp<=100)
  22.                         cout<<"歡";
  23.                 if(tmp>=101 && tmp<=120)
  24.                         cout<<"歡迎";
  25.                 if(tmp>=121 && tmp<=140)
  26.                         cout<<"歡迎光";
  27.                 if(tmp>=141 && tmp<=160)
  28.                         cout<<"歡迎光臨";
  29.                 if(tmp>=161 && tmp<=170)
  30.                         cout<<" ";
  31.                 if(tmp>=171 && tmp<=180)
  32.                         cout<<"歡迎光臨";
  33.                 if(tmp>=181 && tmp<=190)
  34.                         cout<<" ";
  35.                 if(tmp>=191 && tmp<=200)
  36.                         cout<<"歡迎光臨";
  37.                 if(tmp>=201 && tmp<=210)
  38.                         cout<<" ";
  39.                 if(tmp>=211 && tmp<=220)
  40.                         cout<<"歡迎光臨";
  41.                 system("cls");
  42.         }
  43.         goto re;
  44.         system ("pause");
  45.         return 0;
  46. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int speed,tmp;
  7.    cout<<"請輸入廣告刊版的出現倍率:";
  8.    cin>>speed;
  9.    for(int i=1;i<=120*speed;i++)
  10.    {
  11.          tmp=i/speed;
  12.          if(tmp>=1 && tmp<=10)
  13.          {
  14.           cout<<"歡";
  15.          }
  16.           if(tmp>=11 && tmp<=20)
  17.          {
  18.           cout<<" 光";
  19.          }
  20.          if(tmp>=21 && tmp<=30)
  21.          {
  22.           cout<<"  光";
  23.          }            
  24.          if(tmp>=31 && tmp<=40)
  25.          {
  26.           cout<<"   臨";
  27.          }         
  28.          if(tmp>=41 && tmp<=50)
  29.          {
  30.           cout<<"歡";
  31.          }  
  32.          if(tmp>=51 && tmp<=60)
  33.          {
  34.           cout<<"歡迎";
  35.          }  if(tmp>=61 && tmp<=70)
  36.          {
  37.           cout<<"歡迎光";
  38.          }            
  39.          if(tmp>=71 && tmp<=80)
  40.          {
  41.           cout<<"歡迎光臨";
  42.          }  
  43.          if(tmp>=81 && tmp<=90)
  44.          {
  45.           cout<<" ";
  46.          }  
  47.          if(tmp>=91 && tmp<=100)
  48.          {
  49.           cout<<"歡迎光臨";
  50.          }  
  51.          if(tmp>=101 && tmp<=110)
  52.          {
  53.           cout<<" ";
  54.          }   
  55.          if(tmp>=111 && tmp<=120)
  56.          {
  57.           cout<<"歡迎光臨";
  58.          }
  59.          system("cls");                     
  60.    }
  61.     system("pause");
  62.     return 0;
  63. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:   
  7.    
  8.     int tmp;
  9.      
  10.     for(int i=1;i<=260;i++)
  11.     {
  12.        tmp = i;
  13.       
  14.        if(tmp>=1 && tmp<=20)
  15.        cout<<"謝"<<endl;
  16.       
  17.        if(tmp>=21 && tmp<=40)
  18.        cout<<"  謝"<<endl;
  19.       
  20.        if(tmp>=41 && tmp<=60)
  21.        cout<<"    光"<<endl;
  22.       
  23.        if(tmp>=61 && tmp<=80)
  24.        cout<<"      臨"<<endl;
  25.       
  26.        if(tmp>=81 && tmp<=100)
  27.        cout<<"謝"<<endl;
  28.    
  29.        if(tmp>=101 && tmp<=120)
  30.        cout<<"謝謝"<<endl;
  31.       
  32.        if(tmp>=121 && tmp<=140)
  33.        cout<<"謝謝光"<<endl;
  34.       
  35.        if(tmp>=141 && tmp<=160)
  36.        cout<<"謝謝光臨"<<endl;
  37.       
  38.        if(tmp>=161 && tmp<=180)
  39.        cout<<"  "<<endl;
  40.       
  41.        if(tmp>=181 && tmp<=200)
  42.        cout<<"謝謝光臨"<<endl;
  43.       
  44.        if(tmp>=201 && tmp<=220)
  45.        cout<<"  "<<endl;
  46.       
  47.        if(tmp>=221 && tmp<=240)
  48.        cout<<"謝謝光臨"<<endl;
  49.       
  50.        if(tmp>=241 && tmp<=260)
  51.        cout<<"   "<<endl;

  52.        system("cls");               
  53.     }
  54.       goto re;
  55.       

  56.     system("pause");
  57.     return 0;
  58. }
複製代碼

TOP

  1. #include<iostream>          //☆★◇◆□■▽▼㊣℅¯>﹤㏒
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a;
  7.     cout<<"請輸入倍率"<<endl;
  8.     cin>>a;                                                    //alt+41405=■,alt+41404=□;
  9. re:  
  10.      int tmp;
  11.      for(int i=1; i<= 110*a; i++)
  12.      {
  13.          tmp =i/a;  
  14.      if(tmp>=1 && tmp<=10)
  15.      cout<<"▽歡▽"<<endl;
  16.      if(tmp>=11 && tmp<=20)
  17.      cout<<"▽  迎▽"<<endl;        
  18.      if(tmp>=21 && tmp<=30)
  19.      cout<<"▽    光▽"<<endl;        
  20.      if(tmp>=31 && tmp<=40)        
  21.      cout<<"▽      臨▽"<<endl;        
  22.      if(tmp>=41 && tmp<=50)
  23.      cout<<"▽歡▽"<<endl;        
  24.      if(tmp>=51 && tmp<=60)
  25.      cout<<"▽歡迎▽"<<endl;        
  26.      if(tmp>=61 && tmp<=70)
  27.      cout<<"▽歡迎光▽"<<endl;      
  28.      if(tmp>=71 && tmp<=80)
  29.      cout<<"▽歡迎光迎▽"<<endl;        
  30.      if(tmp>=81 && tmp<=100)
  31.      cout<<" "<<endl;
  32.      if(tmp>=101 && tmp<=110)
  33.      cout<<"▽歡迎光迎▽"<<endl;
  34.     system("cls");
  35. }                                                   
  36. goto re;
  37.   system("pause");
  38. return 0;
  39. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int speed,tmp;
  7.    cout<<"請輸入廣告刊版的出現倍率:";
  8.    cin>>speed;
  9.    for(int i=1;i<=120*speed;i++)
  10.    {
  11.          tmp=i/speed;
  12.          if(tmp>=1 && tmp<=10)
  13.          {
  14.           cout<<"歡";
  15.          }
  16.           if(tmp>=11 && tmp<=20)
  17.          {
  18.           cout<<" 光";
  19.          }
  20.          if(tmp>=21 && tmp<=30)
  21.          {
  22.           cout<<"  光";
  23.          }            
  24.          if(tmp>=31 && tmp<=40)
  25.          {
  26.           cout<<"   臨";
  27.          }         
  28.          if(tmp>=41 && tmp<=50)
  29.          {
  30.           cout<<"歡";
  31.          }  
  32.          if(tmp>=51 && tmp<=60)
  33.          {
  34.           cout<<"歡迎";
  35.          }  if(tmp>=61 && tmp<=70)
  36.          {
  37.           cout<<"歡迎光";
  38.          }            
  39.          if(tmp>=71 && tmp<=80)
  40.          {
  41.           cout<<"歡迎光臨";
  42.          }  
  43.          if(tmp>=81 && tmp<=90)
  44.          {
  45.           cout<<" ";
  46.          }  
  47.          if(tmp>=91 && tmp<=100)
  48.          {
  49.           cout<<"歡迎光臨";
  50.          }  
  51.          if(tmp>=101 && tmp<=110)
  52.          {
  53.           cout<<" ";
  54.          }   
  55.          if(tmp>=111 && tmp<=120)
  56.          {
  57.           cout<<"歡迎光臨";
  58.          }
  59.          system("cls");                     
  60.    }
  61.     system("pause");
  62.     return 0;
  63. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     for(int i=1;i<=120;i++)
  8.     {
  9.         if(i>=1 && i<=10)
  10.              cout<<"歡";
  11.         if(i>=11 && i<=20)
  12.              cout<<"  迎";
  13.         if(i>=21 && i<=30)
  14.              cout<<"    光";
  15.         if(i>=31 && i<=40)
  16.              cout<<"      臨";
  17.         if(i>=41 && i<=50)
  18.              cout<<"歡";
  19.         if(i>=51 && i<=60)
  20.              cout<<"歡迎";
  21.         if(i>=61 && i<=70)
  22.              cout<<"歡迎光";
  23.         if(i>=71 && i<=80)
  24.              cout<<"歡迎光臨";
  25.         if(i>=81 && i<=90)
  26.              cout<<" ";
  27.         if(i>=91 && i<=100)
  28.              cout<<"歡迎光臨";
  29.         if(i>=101 && i<=110)
  30.              cout<<" ";
  31.         if(i>=111 && i<=120)
  32.              cout<<"歡迎光臨";
  33.         system("cls");
  34.     }
  35.     goto re;
  36.     system("pause");
  37.     return 0;
  38. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:     
  7.     for(int i=1; i<=220; i++)
  8.     {   
  9.         if(i>=1 && i<=20)
  10.         {
  11.              cout<<"歡";
  12.         }
  13.         if(i>=21 && i<=40)
  14.         {
  15.              cout<<"  迎";
  16.         }
  17.         if(i>=41 && i<=60)
  18.         {
  19.              cout<<"    光";
  20.         }
  21.         if(i>=61 && i<=80)
  22.         {
  23.              cout<<"      臨";
  24.         }
  25.         if(i>=81 && i<=100)
  26.         {
  27.              cout<<"歡";
  28.         }
  29.         if(i>=101 && i<=120)
  30.         {
  31.              cout<<"歡迎";
  32.         }
  33.         if(i>=121 && i<=140)
  34.         {
  35.              cout<<"歡迎光";
  36.         }
  37.         if(i>=141 && i<=160)
  38.         {
  39.              cout<<"歡迎光臨";
  40.         }
  41.         if(i>=161 && i<=170)
  42.         {
  43.              cout<<" ";
  44.         }
  45.         if(i>=171 && i<=180)
  46.         {
  47.              cout<<"歡迎光臨";
  48.         }   
  49.         if(i>=181 && i<=190)
  50.         {
  51.              cout<<" ";
  52.         }
  53.         if(i>=191 && i<=200)
  54.         {
  55.              cout<<"歡迎光臨";
  56.         }
  57.         if(i>=201 && i<=210)
  58.         {
  59.              cout<<" ";
  60.         }
  61.         if(i>=211 && i<=220)
  62.         {
  63.              cout<<"歡迎光臨";
  64.         }
  65.         system("cls");
  66.     }
  67.     goto re;
  68.     system("pause");   
  69.     return 0;
  70. }
複製代碼

TOP

返回列表