本帖最後由 tonyh 於 2018-6-20 17:08 編輯
試運用巢狀迴圈完成以下圖案:
 - #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- for(______________)
- {
- for(______________)
- {
- cout<<"*";
- }
- cout<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼- using namespace std;
- int main()
- {
- for(int i=1; i<=5; i++)
- {
- for(int j=1; j<=i; j++)
- {
- cout<<"*";
- }
- cout<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |