#define row 50
#define col 50
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
void main()
{
void data_entry_matrix(int cols,int rows=3);
clrscr();
cout<<"\n\n\tusing rows as default value";
cout<<"\n\n\tEnter Number of Column You want to enter:-";
int cols;
cin>>cols;
data_entry_matrix(cols);
getch();
}
void data_entry_matrix(int c, int r)
{
clrscr();
int matrix[row][col];
cout<<"\n\n\t\tEnter Your Data for Matrix "<<r<<"x"<<c<<"\n\n\n\t";
//for input
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cin>>matrix[i][j];
}
}
cout<<endl<<endl<<endl;
//for display
cout<<"\n";
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cout<<setw(5)<<matrix[i][j];
}
cout<<endl;
}
}
#define col 50
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
void main()
{
void data_entry_matrix(int cols,int rows=3);
clrscr();
cout<<"\n\n\tusing rows as default value";
cout<<"\n\n\tEnter Number of Column You want to enter:-";
int cols;
cin>>cols;
data_entry_matrix(cols);
getch();
}
void data_entry_matrix(int c, int r)
{
clrscr();
int matrix[row][col];
cout<<"\n\n\t\tEnter Your Data for Matrix "<<r<<"x"<<c<<"\n\n\n\t";
//for input
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cin>>matrix[i][j];
}
}
cout<<endl<<endl<<endl;
//for display
cout<<"\n";
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cout<<setw(5)<<matrix[i][j];
}
cout<<endl;
}
}
0 comments:
Post a Comment