U E D R , A S I H C RSS

마방진/변준원

~cpp 
#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int size,i,j;
	
	cout << "몇행(열) ? = " ;
	cin >> size;

	vector <vector <int> > mabang; 
 
    mabang.resize(size); 
 
    for (i = 0 ; i < size ; i++) 
    { 
         mabang[i].resize(size); 
    } 
 

	for(i=0;i<size;i++)
	{
		for(j=0;j<size;j++)
			mabang[i][j]=0;
		
	}
	mabang[0][size/2]=1;
	
	for(mabang[size-1][size/2]) != size*size)
	{
		if(i<0)
			i=i+size;
			j=j+1;
			mabang[i][j]++;
	

	}		
	for(i=0;i<size;i++)
	{
		for(j=0;j<size;j++)
		cout<< mabang[i][j] << "\t";
	cout<<endl;
	}
	return 0;
}

	
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0052 sec