Board logo

標題: 禮多人不怪 [打印本頁]

作者: may    時間: 2013-8-24 17:16     標題: 禮多人不怪

有千千萬萬種寫法,可用for迴圈,say hello10次
作者: 李彥彤    時間: 2013-8-24 17:18

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     for (int i=1;i<=10;i++)
  7.     {
  8.           cout<<"hello"<<endl;   
  9.      }
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

作者: 周雍程    時間: 2013-8-24 17:18

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     for(int i = 1;i <= 10; i++)
  7.     {
  8.     cout << "hello" << endl;
  9.     }
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

作者: 張彥承    時間: 2013-8-24 17:21

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     for(int i=6;i<=15;i++)
  7.     {
  8.    
  9.           cout<<"hello"<<endl;   
  10.    
  11.     }
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

作者: 周雍程    時間: 2013-8-24 17:21

本帖最後由 周雍程 於 2013-8-24 17:34 編輯
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     for(int i =11 ; i <= 20; i++)
  7.     {
  8.     cout << "hello" << endl;
  9.     }
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

作者: 李彥彤    時間: 2013-8-24 17:21

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     for (int a=1;a<=10;a++)
  7.     {
  8.            cout<<"hello"<<endl;   
  9.      }
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

作者: 張郁偵    時間: 2013-8-24 17:23

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main ()
  5. {
  6.    for (int i=5;i<=14;i++)
  7.   {
  8.     cout<<"hello"<<endl;
  9.   }
  10.   system("pause");
  11.   return 0;
  12. }
複製代碼

作者: 張郁庭    時間: 2013-8-24 17:23

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     cout<<"hello"<<endl;
  7.     cout<<"hello"<<endl;
  8.     cout<<"hello"<<endl;
  9.     cout<<"hello"<<endl;
  10.     cout<<"hello"<<endl;
  11.     cout<<"hello"<<endl;
  12.     cout<<"hello"<<endl;
  13.     cout<<"hello"<<endl;
  14.     cout<<"hello"<<endl;
  15.     cout<<"hello"<<endl;
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

作者: 張郁庭    時間: 2013-8-24 17:26

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     for(int i = 15;i <= 24; i++)
  7.     cout<<"hello"<<endl;
  8.     system("pause");
  9.     return 0;
  10. }
複製代碼

作者: 張峻瑋    時間: 2013-8-24 17:35

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main ()
  5. {
  6.    for (int i=10;i<=19;i++)
  7.   {
  8.     cout<<"hello"<<endl;
  9.   }
  10.   system("pause");
  11.   return 0;
  12. }
複製代碼

作者: 張峻瑋    時間: 2013-8-31 16:56

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()

  5. {
  6.     for(int i=20;i<=39;i+=2)
  7.     {
  8.         cout<<"hello"<<endl;   
  9.     }
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2