#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<"please input n subject to n=7"<<endl;
int cols;
cin>>cols;
int n1=cols/2;
int row=4;
for(int i=1;i<=row;i++)
{ int c=0;
while(c<cols)
{
if(i==row)
{
for(int k=0;k<cols;k++)
cout<<"*";
cout<<endl;
return 0;
}
if(c==cols/2-i+1||c==cols/2+i-1)
cout<<"*";
else
cout<<" ";
c++;
}
cout<<endl;
}
return 0;
}
Acclerated c++之打印三角形

最新推荐文章于 2021-06-24 21:26:30 发布
