返回列表 發帖
本帖最後由 張桔熙 於 2023-2-3 20:58 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     for(int i=1; i<=7; i++)        
  7.     {
  8.         for(int j=1;j<=7-i; j++)     
  9.         {
  10.              cout<<" ";
  11.         }
  12.         for(int k=1;k<=2*i-1; k++)   
  13.         {
  14.              cout<<"*";        
  15.         }
  16.         cout<<endl;
  17.     }
  18.    
  19.     for(int i=0;i<=5; i++)
  20.     {
  21.         for(int j=0;j<=i; j++)
  22.         {
  23.              cout<<" ";
  24.         }
  25.         for(int k=0;k<=10-2*i; k++)
  26.         {
  27.              cout<<"*";        
  28.         }
  29.         cout<<endl;
  30.     }
  31.     system("pause");
  32.     return 0;
  33. }
複製代碼

TOP

返回列表