返回列表 發帖

小星星 1

本帖最後由 tonyh 於 2018-6-20 17:08 編輯

試運用巢狀迴圈完成以下圖案:

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

返回列表