返回列表 發帖

小星星1

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

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

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

TOP

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

TOP

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

  3. int main()
  4. {
  5.     for(int i=1; i<=5; i++)
  6.     {
  7.         for(int j=1; j<=i; j++)
  8.         {
  9.             cout<<"*";
  10.         }
  11.         cout<<endl;
  12.     }

  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

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

TOP

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

TOP

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

TOP

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

TOP

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

TOP

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

TOP

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

TOP

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

TOP

返回列表