标签:names include ret i++ void code int define 草稿
http://codevs.cn/problem/1160/
#include<iostream>
using namespace std;
#define M 100
int a[M][M];
void pt(int n)
{
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
} 
//圆圈循环 
int main()
{
	int n=5;
	//cin>>n;
	int sn=n*n;
	for(int i=1;i<=n/2+1;i++)
	{
		for(int j=n-i;j>=0;j--)
		{
			a[5-i][j]=sn--;	
		}
		for(int j=n-i;j>=1;j--)
		{
			a[j-1][0]=sn--;	
		}
		for(int j=0;j<=n-i;j++)
		{
			a[0][j]=sn--;	
		}
		for(int j=1;j<=n-i;j--)
		{
			a[j-1][0]=sn--;	
		}
	}
	pt(n); 
	return 0;
}
标签:names include ret i++ void code int define 草稿
原文地址:https://www.cnblogs.com/hxh88/p/9250533.html