No older revisions available
No older revisions available
~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;
}