Home » Source Code » » 魔方程序.cpp

魔方程序.cpp ( File view )

From:
  • By 2010-08-30
  • View(s):4
  • Download(s):0
  • Point(s): 1
			#include<stdio.h>
#include<stdlib.h>
#define MAX_SIZE 15
void main()
{

	static int square[MAX_SIZE][MAX_SIZE];
    int i,j,row,column;
	int count;
	int size;
    printf("Enter the size of the square:");
	scanf("%d",&size);
	if(size<1 || size>MAX_SIZE+1)
	{

		fprintf(stderr,"Errot! size is out of range\n");
		exit (1);
	
}
	if(!(size%2))
	{

		fprintf(stderr,"Errot! size is even\n");
		exit (1);
	
}
	for(i=0;i<size;i++)
		for(j=0;j<size;j++)
		   square[i][j]=0;
	square[0][(size-1)/2]=1;
	i=0;
	j=(size-1)/2;
	for(count=2;count<=size*size;count++)
	{

		row=(i-1<0)?(size-1):(i-1);
		column=(j-1<0)?(siz
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
魔方程序.cpp949.00 B16-05-07|21:23
...
Sponsored links

魔方程序.cpp (824.00 B)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D