Académique Documents
Professionnel Documents
Culture Documents
cpp
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"Please Enter Matrix Order(Odd Number): ";
cin>>n;
if(n%2!=1)
{
cout<<"Please enter odd number"<<endl;
return 0;
}
int m[n][n];
bool b[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
//cout<<m[i][j]<<"-"<<b[i][j]<<";\t";
b[i][j]=false;
}
//cout<<endl;
}
int i,j;
i=n/2;
j=n-1;
-1-
E:\Study\MTECH\3rd sem\MAL701\Lab\CODES\assign5.cpp
if(i<0) i=n+i;
if(j==n) j=0;
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<m[i][j]<<"\t";//<<"-"<<b[i][j]<<";\t";
//b[i][j]=false;
}
cout<<endl;
}
//cout<<"hello"<<endl;
return 0;
}
-2-