/*
compiler- Turbo c++ author- Mangilal Sharma
--------------------------------------------------------*/
/* Do work of matrix by using only one dimensional array */
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
void main()
{
clrscr();
int m,a[100],n;
cout<<"Enter no. of rows for matrix:";
cin>>n;
cout<<"Enter no. of columns for matrix:";
cin>>m;
cout<<"Enter the elements for matrix:\n";
int k=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cout<<"Enter element for matrix location "<<i<<","<<j<<" :";
cin>>a[k++];
}
}
k=0;
for(i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cout<<"matrix location for"<<i<<","<<j<<" :";
cout<<"is"<<&a[k++];cout<<endl;
}
}
int row;
printf("Which row we show u:");
scanf("%d",&row);
k=(row-1)*m;
{
for(int j=0;j<m;j++)
{
cout<<a[k++];cout<<"\t";
}
cout<<endl;
}
getch();
}
/*=========================19Nov.,2011=============================*/
This is a try to put the solutions of each possible problem related to C and C++. You can find here C basic lab, C++ basic Lab, Data Structure Lab, DAA Lab, Operating System Lab, Graphics Lab, Compiler Lab, Network Lab, and other problems.
Subscribe to:
Post Comments (Atom)
.thank you for sharing useful post.
ReplyDeletewen programming tutorial
welookups
nice article for beginners.thank you.
javacodegeeks