Code:
#include<iostream.h> //should be #include<iostream>
// iostream.h is outdated include - if you are using it
//it is time to change the compiler
void middle(int a[][10], int n)
{
int i,j;
cout<<"Middle Column:- "; //should be std::cout
for(i=n/2,j=0; i<n; j++)
{
cout<<a[i][j]<<" ";
}
cout<<"Middle Row:- ";
for(j=n/2,i=0; i<n; i++)
{
cout<<a[i][j]<<" ";}
}
void main() //read FAQ it shoudl be int main()
{
int size,a[10][10]; //think about using std::vector
cout<<"Enter the size : ";
cin>>size;
cout<<"Enter the elements of the matrix : ";
for(int i=0; i<size; i++)
{
for(int j=0; j<size; j++)
cin>>a[i][j];
}
for(i=0; i<size; i++) //you need int i here as well - again your compiler is outdated
{
for(int j=0; j<size; j++)
cout<<a[i][j]<<" ";
cout<<"\n";
}
middle(a,size);
}