返回列表 發帖

跑馬燈 (五)

本帖最後由 王瑞喻 於 2019-12-28 14:02 編輯

使文字訊息在畫面上反覆地左右移動.


本帖隱藏的內容需要回復才可以瀏覽
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1;i<100;i++)
  9.     {
  10.          if(i<=50)
  11.              j++;
  12.          else
  13.              j--;
  14.          for(int k=1; k<=j; k++)
  15.              cout<<" ";
  16.          cout<<"歡迎光臨"<<endl;
  17.          _sleep(50);
  18.          system("cls");   
  19.     }
  20.     goto re;
  21.     system("pause");
  22.     return 0;
  23. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     for(int i=0;i<=100;i++)
  8.     {  
  9.        if(i<50)
  10.                for(int j=0;j<i;j++)
  11.                {
  12.                        cout<<" ";
  13.                }
  14.        else
  15.                for(int j=100;j>i;j--)
  16.                {
  17.                        cout<<" ";
  18.                }
  19.        cout<<"歡迎光臨";
  20.        _sleep(50);
  21.        system("cls");
  22.     }
  23.     goto re;   
  24.     system("pause");
  25.     return 0;
  26. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1; i<=100; i++)
  9.     {
  10.         if(i<=50)
  11.             j++;
  12.         else
  13.             j--
  14.         for(int k=1; k<=j; k++)
  15.         {
  16.             cout<<" ";
  17.         }
  18.         cout<<"歡迎光臨"<<endl;
  19.         _sleep(50);
  20.         systm("cls");
  21.     }
  22.     goto re;
  23.     system("pause");
  24.     return 0;
  25. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1; i<=100; i++)
  9.     {
  10.         if(i<=50)      
  11.         {
  12.             for(int j=1;j<=i;j++)   
  13.                 cout<<" ";
  14.             cout<<"歡迎光臨";
  15.         }
  16.         else
  17.         {
  18.             for(int j=1;j<=100-i;j++)   
  19.                 cout<<" ";
  20.             cout<<"歡迎光臨";
  21.         }
  22.         _sleep(87);
  23.         system("cls");               
  24.     }
  25.     goto re;
  26.     system("pause");
  27.     return 0;
  28. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1; i<=100; i++)
  9.     {
  10.             if(i<=50)
  11.                 j++;
  12.             else
  13.                 j--;
  14.             for(int k=1; k<=j; k++)
  15.             {
  16.                     cout <<" ";
  17.             }
  18.             cout<<"敬老尊賢"<<endl;
  19.             _sleep(50);
  20.             system("cls");
  21.     }
  22.     goto re;
  23.        system("pause");
  24.     return 0;
  25. }
複製代碼

TOP

本帖最後由 鄭羽捷 於 2019-12-7 10:59 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1; i<=100; i++)
  9.     {
  10.         if(i<=50)
  11.             j++;
  12.         else
  13.             j--;
  14.         for(int k=1; k<=j; k++)
  15.         {
  16.             cout<<" ";
  17.         }
  18.         cout<<"歡迎光臨"<<endl;
  19.         _sleep(50);
  20.         system("cls");
  21.     }
  22.     goto re;
  23.     system("pause");
  24.     return 0;
  25. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     for(int i=1;i<=100;i++)
  8.     {
  9.         if(i<=50)
  10.         {
  11.             for(int a=1;a<=i;a++)
  12.             {   
  13.                 cout<<" ";
  14.             }
  15.         }else
  16.         {
  17.             for(int j=100;j>=i;j--)
  18.             {
  19.                 cout<<" ";
  20.             }
  21.         }
  22.         cout<<"來鴨~~~~~~"<<endl;
  23.         _sleep(40);
  24.         system("cls");   
  25.     }
  26.     goto re;   
  27.     system("pause");
  28.     return 0;
  29. }
複製代碼

TOP

本帖最後由 王翎璇 於 2019-12-14 10:06 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1; i<100; i++)
  9.     {
  10.         if(i<=50)
  11.             j++;
  12.         else
  13.             j--;
  14.         for(int k=1; k<j;for(int k=1; k<=j; k++)
  15.         {
  16.             cout<<" ";
  17.         }
  18.         cout<<"歡迎光臨"<<endl;
  19.         _sleep(50)
  20.         system("cls");   
  21.     }
  22.     goto re;   
  23.     system("pause");
  24.     return 0;
  25. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1 ; i<=100 ; i++)
  9.     {
  10.         if(i<=50)
  11.         {
  12.             j++;         
  13.         }else
  14.         {
  15.             j--;     
  16.         }
  17.         for(int k=1 ; k<=j ; k++)
  18.         {
  19.             cout<<" ";         
  20.         }
  21.         cout<<"歡迎光臨"<<endl;
  22.         _sleep(50);
  23.         system("cls");            
  24.     }
  25.     goto re;
  26.     system("pause");
  27.     return 0;
  28. }
  29.    
複製代碼

TOP

本帖最後由 王建葦 於 2019-12-28 14:01 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int j=0;
  8.     for(int i=1;i<=100;i++)
  9.     {
  10.          if(i<=50)
  11.          {
  12.              j++;
  13.          }else
  14.          {
  15.              j--;
  16.          }
  17.          for(int k=1;k<=j;k++)
  18.          {
  19.               cout<<" ";
  20.          }
  21.          cout<<"歡迎光臨";
  22.          _sleep(50);
  23.          system("cls");
  24.     }
  25.     goto re;
  26.     system("pause");
  27.     return 0;
  28. }
複製代碼
Jian-wei Wang

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int i=0,s=1;
  7.     re:
  8.     for(int j=0;j<=i;j++)
  9.         cout<<"  ";
  10.     i=i+s;
  11.     if(i>=20)
  12.         s=-1;
  13.     else if(i<0)
  14.         s=1;
  15.     cout<<"歡迎光臨";
  16.     _sleep(100);
  17.     system("cls");
  18.     goto re;   
  19.     system("pause");
  20.     return 0;
  21. }
複製代碼

TOP

返回列表