[求助]C++编程
各位高手,怎么用C++编出*
* *
* * *
* * * *
* * *
* *
*
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"请输入一个整数:";
cin>>n;
int i,j,k;
for (i = 1;i<=n;i++)
{
for (k = 1;k<=n-i;k++)
{
cout<<" ";
}
for (j=0;j<i;j++ )
{
cout<<"*"<<" ";
}
cout<<endl;
}
for (i = 1;i<n;i++)
{
for (k =n-i;k<n;k++)
{
cout<<" ";
}
for (j=n-i;j>0;j--)
{
cout<<"*"<<" ";
}
cout<<endl;
}
return 0;
}