回复 7楼 yuccn
还是版主的程序牛,佩服!!
#include<iostream>
using namespace std;
void main()
{
int m,n,i,j;
int data,a[100][100];
cout<<"input n:";
cin>>data;
m=1;n=2*data-1;
/******************************************/
while(m<=n)
{
for(i=m-1;i<=n-1;i++)
{
a[m-1][i]=m;
a[n-1][i]=m;
a[i][m-1]=m;
a[i][n-1]=m;
}
m++;
n--;
}
/******************************************/
for(i=0;i<2*data-1;i++)
{
for(j=0;j<2*data-1;j++)
cout<<" "<<a[i][j];
cout<<endl;
}
}