Thursday, October 16, 2014

Write a program to make matrix by passing column parameter as default argument in C++



Prog 15 Write a program to make matrix by passing column parameter as default  argument.

#include<iostream.h>
#include<conio.h>
void matrix(int m,int n=3);
void matrix(int m,int n)
{
int A[5][5];
clrscr();
cout<<"Enter the value";
for(int i=0;i<m;i++)
{
for(int j=0;j++)
{
cin>>A[i][j];
}
}
cout<<"\n the matrix is"<
for( i=0;i+)
{
for(int j=0;j++)
{
cout<<"\t"<[i][j];
}
cout<<"\n";
}
}
void main()
{
int x;
clrscr();
cout<<"\n enter the value of x";
cin>>x
matrix(x); 
getch();
}

No comments: