第3周專案3—輸出星號圖(空心三角形)
阿新 • • 發佈:2019-01-25
執行結果:/* *Copyright(c) 2015.煙臺大學計算機與控制工程學院 *ALL rights reserved. *檔名稱:test.cpp *作者:楊馳 *完成日期:2016年3月15日 *問題描述:程式設計輸出 * * * * * * * * * * * * *********** */ #include<iostream> using namespace std; int main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=6-i;j++) cout<<" "; cout<<"*"; for(j=1;j<=2*i-3;j++) cout<<" "; if(i!=1)cout<<"*"<<endl; else cout<<endl; } for(i=1;i<=11;i++) cout<<"*"; cout<<endl; return 0; }