本帖最後由 張桔熙 於 2023-2-3 20:58 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- for(int i=1; i<=7; i++)
- {
- for(int j=1;j<=7-i; j++)
- {
- cout<<" ";
- }
- for(int k=1;k<=2*i-1; k++)
- {
- cout<<"*";
- }
- cout<<endl;
- }
-
- for(int i=0;i<=5; i++)
- {
- for(int j=0;j<=i; j++)
- {
- cout<<" ";
- }
- for(int k=0;k<=10-2*i; k++)
- {
- cout<<"*";
- }
- cout<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |