呵呵,正好随便写,有个C++的代码,刚才运行了,能行,给你吧,有错的地方还望大家指正;
#include<iostream>
using namespace std;
int main()
{
int i,j,n;
cout<<"please input n"<<endl;
cin>>n;
for(i=1;i<=n;i++)
{
for(j=1;j<=n-1+i;j++)
if(j==n+1-i||j==n-1+i)
cout<<"*";
else
cout<<" ";
cout<<endl;
}
for(i=1;i<n;i++)
{
for(j=1;j<=2*n-1-i;j++)
if(j==i+1||j==2*n-1-i)
cout<<"*";
else
cout<<" ";
cout<<endl;
}
return 0;
}