Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
Home
Welcome To Programming Page Of 2k1CP
All the given programs are thoroughly checked &
debugged and there is full guarantee for each and every program execution.
LAB # 15
Solution # 2
#include<iostream.h>
#include<conio.h>
void main(void)
{
clrscr();
const
int size=10;
int a[size];
cout<<"Enter array elements of maximum 10 elements\n";
for(int i=0;i<10;i++)
cin>>a[i];
cout<<"Entered array is...\n";
for(int j=0;j<10;j++)
cout<<"\t"<<a[j];
cout<<"Address of each element of array is...\n";
for(int k=0;k<10;k++)
cout<<"\t"<<&a[k];
getch();
}
Solution # 3
#include<iostream.h>
#include<conio.h>
void main(void)
{ int rowsum=0;int colsum=0;int z;int y;
clrscr();
int a[3][3]={1,2,3,4,5,6,7,8,9};
for(int b=0;b<3;b++)
for(int c=0;c<3;c++)
cout<<"\t"<<a[b][c];
cout<<"\nEnter 0,1,2 for sum of Ist,2nd or 3rd row=";
cin>>z;
for(int e=0;e<3;e++)
rowsum+=a[z][e];
cout<<"\nsum of "<<z+1<<" row="<<rowsum;
cout<<"\nEnter 0,1,2 for sum of Ist,2nd or 3rd column=";
cin>>y;
for(int f=0;f<3;f++)
colsum+=a[f][y];
cout<<"\nsum of "<<y+1<<" column="<<colsum;
int sum=0;
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
sum+=a[i][j];
cout<<"\n Total sum="<<sum;
getch();
}
Solution # 4
#include<iostream.h>
#include<conio.h>
class sort
{
int list[10];
public:
void input()
{
cout<<"Enter the array...\n";
for(int i=0;i<10;i++)
cin>>list[i];
}
void print()
{
cout<<"Entered array =";
for(int j=0;j<10;j++)
cout<<"\t"<<list[j];
}
void bubblesort()
{
for(int k=0;k<10;k++)
for(int pass=0;pass<10-1;pass++)
for(int l=0;l<10-1;l++)
if(list[l]>list[l+1])
{
int hold=list[l];
list[l]=list[l+1];
list[l+1]=hold;
} cout<<"\nSorted array is=";
for(int m=0;m<10;m++)
cout<<list[m]<<"\t";
}
};
void main(void)
{
clrscr();
sort s;
s.input();
s.print();
s.bubblesort();
getch();
}
LAB # 16
Solution # 2
#include<iostream.h>
#include<conio.h>
int func(int[],int);
void main(void)
{
clrscr();
const int size=6;
int a[size]={10,11,12,13,14,15};
int x;
x=func(a,size);
cout<<"Smallest number of array is="<<x<<endl;
getch();
}
int func(int a[],int size)
{ for(int i=0;i<size;i++)
if (a[i]<a[i+1])
return a[i];
}
Wanna query about any program or suggestions.
Mail us on : -
webmaster@2k1cp.com
©2001.All rights
reserved by
www.2k1cp.com.