Documente Academic
Documente Profesional
Documente Cultură
and find two one dimensional array which should be the average of values in columns and rows.
SOURCE CODE:
#include<iostream.h> #include<conio.h> main() { int max[3][3],i,j,s; cout<<"enter the elements of array"; for(i=0;i<3;i++) { for(j=0;j<3;j++) { cin>>max[i][j]; } } cout<<"array entered is";
JASLEEN
E101045
100180305180
cout<<"\n"; for(i=0;i<3;i++) { for(j=0;j<3;j++) { cout<<max[i][j]; cout<<"\t"; } cout<<"\n"; } for(i=0;i<3;i++) {s=0; for(j=0;j<3;j++) { s=s+max[i][j];
} cout<<"sum of row\t"<<s<<"\t";
JASLEEN
E101045
100180305180
getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 10: WAP to check whether the ISBN (International Standard Book
Number) is valid or not.( An ISBN is uniquely used to identify a book. It is made up of ten digits and to check if its valid or not the weighted sum of 10 digits must be evenly divisible by 11). Use a function to input ISBN , to check validity and to display whether no. is valid or not.
SOURCE CODE:
#include<iostream.h> #include<conio.h> main() { int a,i,s,j; cout<<"enter the ISBN number"; for(i=0;i<10;i++) { cin>>a; } s=0; for(i=9,j=1;i>=0;i--,j++) { s=s+a*j; } cout<<"sum of numbers is"<<s<<"\n"; if(s%11==0) cout<<"no. is correct"; else cout<<"no. is not correct"; getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 11: WAP to find the roots of a quadratic equation where in the user
specifies the co-efficients of x2 , x and constant.
SOURCE CODE:
#include<iostream.h> #include<conio.h> #include<math.h> main() { int a,b,c,d; float x1,x2,s; cout<<"enter the coefficients of the quadratic equation"; cin>>a>>b>>c; d=b*b-4*a*c; s=pow(d,0.5); x1=(-b+s)/(2*a); x2=(-b-s)/(2*a); if(d>0)
JASLEEN
E101045
100180305180
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 12: WAP to find the transpose of a two-dimensional matrix using function
where the array is passed as an argument.
SOURCE CODE:
#include<iostream.h> #include<conio.h> main() { int a[3][3],b[3][3],i,j,m,n; cout<<"enter the elements"; for(i=0;i<3;i++) { for(j=0;j<3;j++) { cin>>a[i][j]; } } cout<<"matrix is"<<endl; for(i=0;i<3;i++)
JASLEEN E101045 100180305180
{ for(j=0;j<3;j++) { cout<<a[i][j]; cout<<"\t"; } cout<<"\n"; } for(i=0;i<3;i++) { for(j=0;j<3;j++) { b[j][i]=a[i][j]; } } cout<<"tranpose of the given matrix is"<<endl; for(i=0;i<3;i++) {
JASLEEN
E101045
100180305180
} cout<<"\n"; }
getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
CONCLUSION :Through this program we are able to find the transpose of the
matrix entered by user.
JASLEEN
E101045
100180305180
TASK 13: WAP that creates a two-dimensional matrix representing the Pascal
Triangle. In a Pascal Triangle, each element is the sum of the element directly above it and the element to the left of the element directly above it . A Pascal triangle of size 7 has been illustrated : 1 11 121 1331 14641 1 5 10 10 5 1 1 6 15 20 15 6 1 Generate the triangle using function and can create triangle of any size.
SOURCE CODE:
#include<iostream.h> #include<conio.h> main() { int jas[10][10],i,j; jas[0][0]=1; i=0; for(j=1;j<9;j++) {
JASLEEN
E101045
100180305180
jas[i][j]=0; } for(i=1;i<9;i++) { for(j=0;j<9;j++) { if(j==0) jas[i][j]=jas[i-1][j]; else jas[i][j]=jas[i-1][j]+jas[i-1][j-1]; }} for(i=0;i<9;i++) { for(j=0;j<9;j++) { cout<<jas[i][j]; cout<<"\t"; } cout<<"\n";} getch();
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 14:WAP to make a menu driven program where the user can calculate the
Sum of diagonal elements Sum of 2nd diagonal elements Sum upper triangular elements Sum of lower triangular elements Sum of rows Sum of columns Sum of the complete matrix
SOURCE CODE:
#include<iostream.h> #include<conio.h> main() { int jas[3][3],i,j,s,s1,s2,exit=1; int ch; cout<<"enter the elements of the array"; for(i=0;i<3;i++) { for(j=0;j<3;j++) { cin>>jas[i][j]; }} cout<<"matrix entered is "<<endl; for(i=0;i<3;i++) { for(j=0;j<3;j++) {
JASLEEN
E101045
100180305180
cout<<jas[i][j]; cout<<"\t"; } cout<<"\n"; } while(exit==1) { cout<<"* press 1 for diagonal elements sum 2 for 2nd diagonal elements 3 for sum of row 4 for sum of column 5 for sum of upper triangular elements 6 for lower triangular7 for all the elements 8 to exit*"; cout<<"\n"; cin>>ch; switch(ch) { case 1:{ s=0; for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(i==j) s=s+jas[i][j]; }} cout<<"sum of diagonal elements"<<"\n"<<s<<"\n"; break; } case 2: { s=0; for(i=2;i>=0;i--) { for(j=2;j>=0;j--) { if(i==j) s=s+jas[i][j]; } }
JASLEEN
E101045
100180305180
cout<<"sum of 2nd diagonal elements"<<"\n"<<s<<"\n"; break; } case 3: { for(i=0;i<3;i++) {s1=0; for(j=0;j<3;j++) { s1=s1+jas[i][j]; } cout<<"sum of row"<<s1<<"\t"<<"\n"; } break; } case 4: { for(j=0;j<3;j++) s2=0; { for(i=0;i<3;i++) { s2=s2+jas[i][j]; } cout<<"sum of column"<<s2<<"\t"<<"\n"; } break; } case 5: { int s3=0; for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(j>i)
JASLEEN E101045 100180305180
{ s3=s3+jas[i][j]; } } } cout<<"sum of upper triangular is"<<s3<<endl; break; } case 6: { int s3=0; for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(j<i) { s3=s3+jas[i][j]; } } } cout<<"sum of lower triangular is"<<s3<<endl; break; }
getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK15: WAP to create a structure PERSON where the name , age, gender,
who( father, grandfather, mother etc.) , weight and height of all the members of a family is taken from the user and display the data in descending order of age also in ascending order of height and weight. PURPOSE:By implementing this program we are capable to store the data of a family in the form of structure and arrange the height and weight of the members in the desired order.
SOURCE CODE:
#include<iostream.h> #include<conio.h> struct person { char name; int age; char gender; char who; float weight; float height; }info[10]; main() { int n,i,temp,k; cout<<"*enter the number of members in the family*"; cin>>n; for(i=0;i<n;i++) { cout<<" enter information of "<<i+1<<" member"<<endl; cout<<"name of the member"; cin>>info[i].name; fflush(stdin); cout<<"his/her age"; cin>>info[i].age; fflush(stdin);
JASLEEN
E101045
100180305180
cout<<"his/her gender"; cin>>info[i].gender; fflush(stdin); cout<<"his/her relation in the family"; cin>>info[i].who; fflush(stdin); cout<<"weight of the person"; cin>>info[i].weight; fflush(stdin); cout<<"height of the person"; cin>>info[i].height; } for(i=0;i<n;i++) { for(k=i+1;k<n;k++) { if(info[i].age<info[k].age) { temp=info[i].age; info[i].age=info[k].age; info[k].age=temp; }}} cout<<"*descending order of ages is*\t"; for(i=0;i<n;i++) cout<<info[i].age<<"\t"; for(i=0;i<n;i++) { for(k=i+1;k<n;k++) { if(info[i].height>info[k].height) { temp=info[i].height; info[i].height=info[k].height; info[k].height=temp; }}} cout<<endl; cout<<"*ascending order of heights is*\t";
JASLEEN E101045 100180305180
for(i=0;i<n;i++) cout<<info[i].height<<"\t"; for(i=0;i<n;i++) { for(k=i+1;k<n;k++) { if(info[i].weight>info[k].weight) { temp=info[i].weight; info[i].weight=info[k].weight; info[k].weight=temp; }}} cout<<endl; cout<<"*ascending order of weight is*\t"; for(i=0;i<n;i++) cout<<info[i].weight<<"\t";
getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
CONCLUSION:
Through this program we are able to store the data in the form of structure and sort the information as desired.
JASLEEN
E101045
100180305180
SOURCE CODE:
#include<iostream.h> #include<conio.h> struct date { int day; int month; int year; }; struct employee { char name; int age; struct date doj; }info[10];
main() { int i,n,k,temp,a[10],large; cout<<"enter the number OF employees"; cin>>n; for(i=0;i<n;i++) { cout<<"enter the name of "<<i+1<<"employee"<<endl; cin>>info[i].name; fflush(stdin); cout<<"enter the age of"<<i+1<<"employee"<<endl; cin>>info[i].age; cout<<"enter the date of joining of "<<i+1<<"employee"<<endl; cin>>info[i].doj.day;
JASLEEN
E101045
100180305180
cin>>info[i].doj.month; cin>>info[i].doj.year; } for(i=0;i<n;i++) { a[i]=info[i].doj.year*10000+info[i].doj.month*100+info[i].doj.day; cout<<"doj of employee "<<i+1<<" is"<<a[i]<<"\n"; } large=a[0]; for(i=0;i<n;i++) { if(large<a[i]) { large=a[i];}
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
SOURCE CODE:
#include<iostream.h> #include<conio.h> struct product { int product_id; float weight; int manufacturer_id; }info[10]; main() { int n,i,s; cout<<"enter the number of products"; cin>>n; cout<<"enter the details of the products"; cout<<"\n"; for(i=0;i<n;i++) { cout<<i+1<<".enter the product_id***"; cin>>info[i].product_id; fflush(stdin); cout<<i+1<<".enter the weight of the product in kg***"; cin>>info[i].weight; cout<<i+1<<".enter the manufacturer id***"; cin>>info[i].manufacturer_id; } s=0; for(i=0;i<n;i++) { s=s+info[i].weight;
JASLEEN
E101045
100180305180
weight
of
all
the
products
JASLEEN
E101045
100180305180
OUTPUT:
CONCLUSION: Through this program we are able to find the total weight of
the products .
JASLEEN
E101045
100180305180
SOURCE CODE:
#include<iostream.h> #include<conio.h> class bank_acc { private: static int total; public: int withdraw(); int deposit(); int check_balance(); int display();
}; int bank_acc::total=20000; int bank_acc::withdraw() { int amount; cout<<"*enter the amount*"; cin>>amount; total=total-amount; cout<<"*after withdrawing rupees)*\t"<<total; } int bank_acc::deposit() { int amount;
total
amount
is(in
JASLEEN
E101045
100180305180
cout<<"*enter the amount to be deposited*"; cin>>amount; total=total+amount; cout<<"*after depositing total amount rupees)*\t"<<total; }
is(in
int bank_acc::check_balance() { cout<<"*total balance in account is(in rupees)* "<<total; } main() { cout<<"available balance is Rs 20000"<<endl; bank_acc obj; int inst; cout<<"**press 1 for withdrawing 2 for depositing and 3 for checking balance**"; cin>>inst; switch(inst) { case 1: { obj.withdraw(); break; } case 2: { obj.deposit(); break; } case 3: { obj.check_balance();
JASLEEN E101045 100180305180
}}getch();}
OUTPUT:
CONCLUSION: Throught this program we are capable to find the total amount
in the account after withdrawing or depositing.
JASLEEN
E101045
100180305180
TASK 19: Create class GMshape with data members as startx, starty, length and
breadth. Create member functions to input to get the data, drawline( ) to draw line with initial coordinates as startx and starty and given length, drawsq( ) to draw square and drawrect( ) to draw rectangle.
SOURCE CODE:
#include<iostream.h> #include<conio.h> class drawshape { int startx; int starty; int length; int breadth; public: void getdata(); void drawline(); void drawsq(); void drawrect();
JASLEEN
E101045
100180305180
}; void drawshape::getdata() {
cout<<"enter the starting points"; cin>>startx>>starty; cout<<"length"; cin>>length; cout<<"breadth"; cin>>breadth; } void drawshape::drawline() { cout<<"line drawn is "<<endl; int i; for(i=0;i<=starty;i++) { cout<<endl; } for(i=0;i<=startx;i++)
JASLEEN
E101045
100180305180
{ cout<<" "; }
for(i=0;i<=length;i++) { cout<<"."; } } void drawshape::drawsq() { cout<< "figure drawn is "<<endl; int i,j; for(i=0;i<=starty;i++) { cout<<endl; } for(i=0;i<=startx;i++) { cout<<" "; } for(i=0;i<=length;i++)
JASLEEN
E101045
100180305180
cout<<"."; for(j=0;j<=breadth;j++) { cout<<endl; for(i=0;i<=startx;i++) { cout<<" "; if(i==startx) cout<<"."; } for(i=2;i<=length;i++) { cout<<" "; if(i==length) cout<<"."; }} cout<<endl; for(i=0;i<=startx;i++) cout<<" ";
JASLEEN
E101045
100180305180
for(i=0;i<=length;i++) cout<<".";}
main() { drawshape obj; int ch; cout<<"press 1 to draw a line"<<endl; cout<<" 2 to draw a square or a rectangle"; cin>>ch; switch(ch) { case 1: {
JASLEEN
E101045
100180305180
getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
SOURCE CODE:
#include<iostream.h> #include<conio.h> class fraction { int num1; int num2; int den1; int den2; float result; public: fraction() {
JASLEEN
E101045
100180305180
num1=0; num2=0; den1=1; den2=1; } fraction(int a,int b,int c,int d) { cout<<"enter the numerators"<<endl; cin>>a>>c; cout<<"enter the denominators"<<endl; cin>>b>>d; num1=a; num2=c; den1=b; den2=d; } int multiply() {
result=(float)(num1*num2)/(den1*den2);
JASLEEN
E101045
100180305180
} void display() { int rem,quo,x,y; cout<<"after multiplying"<<result<<endl; cout<<"in fraction"<<num1*num2<<"/"<<den1*den2<<endl; x=num1*num2; y=den1*den2; if(x>y) { rem=x%y; quo=x/y; cout<<"in mixed fraction"<<rem<<"("<<quo<<"/"<<y<<")";} else cout<<"it is a proper fraction"<<endl;
JASLEEN
E101045
100180305180
}}; main() { int x,y,z,r; cout<<"*default constructor*"<<endl; fraction obj; obj.multiply(); obj.display(); cout<<"*parameterised constructor*"<<endl; fraction obj1(x,y,z,r); obj1.multiply();
obj1.display(); getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 21: Write a program to create a class TIME and get the time (in hh-mmss) create DEFAULT, PARAMETERISED & COPY constructors. Create a member function to display the time in seconds.
SOURCE CODE:
#include<iostream.h> #include<conio.h> class seconds { int hour; int min; int sec; public: seconds() { hour=0; min=0; sec=0; }
JASLEEN
E101045
100180305180
{ cout<<"enter the time"<<endl; cin>>h>>m>>s; hour=h; min=m; sec=s; } void display() { cout<<"hours"<<hour<<endl; cout<<"minutes"<<min<<endl; cout<<"seconds"<<sec<<endl; cout<<"time is"<<hour<<"-"<<min<<"-"<<sec<<endl; } void convert() { int time; time=hour*3600+min*60+sec;
JASLEEN
E101045
100180305180
cout<<"time in seconds"<<time<<endl; }}; main() { int a,b,c; cout<<"*default constructor*"<<endl; seconds obj; obj.display(); obj.convert(); cout<<endl; cout<<"*parametrised constructor*"<<endl; seconds obj1(a,b,c); obj1.display(); obj1.convert(); cout<<"*copy constructor*"<<endl; seconds obj2(obj1); obj2.display(); getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 22: Write a program to create a class HOTEL where when a customer
checks-in an object is created and all his details are stored (Name, Age, City, No. of days). Once the customer checks-out delete the object using destructor.
SOURCE CODE:
#include<iostream.h> #include<conio.h> class hotel { private: char name[10]; int age; char city[10]; int no_of_days; public:
JASLEEN
E101045
100180305180
age=0; strcpy(city,"not given"); no_of_days=0; } hotel(char a[],int age1,char b[],int days) { cout<<"enter the name"<<endl; cin>>a; strcpy(name,a); cout<<"enter the age"<<endl; cin>>age; age1=age; cout<<"enter the city"<<endl; cin>>b; strcpy(city,b); cout<<"enter the no. of days"<<endl; cin>>days; no_of_days=days;
JASLEEN
E101045
100180305180
} ~hotel(){};
void display() { cout<<"details entered are"<<endl; cout<<"name of customer"<<name<<endl; cout<<"age"<<age<<endl; cout<<"city"<<city<<endl; cout<<"no. of days"<<no_of_days<<endl; }
JASLEEN
E101045
100180305180
JASLEEN
E101045
100180305180
break;
} case 3: { exit=1; }
}}getch();}
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
S.NO TITLE
REMARKS
9. 10.
WAP to find sum of row and column elements of an array. WAP to make menu driven calculator for performing operations on the elements of a 2d array.
11.
WAP to check whether the ISBN number entered by user is valid or not.
WAP to create a pascal triangle. WAP to find roots of the quadratic equation. WAP to find transpose of a 2-d array. WAP to create structure PERSON And store details like name,age,height etc and sort it.
16.
17.
WAP to create the structure PRODUCT and find the total weight of the products.
JASLEEN
E101045
100180305180
18.
19.
WAP to create class GMSHAPE and draw the shape desired by user.
20.
WAP to create class FRACTION and multiply the two fractions using default and copy constructor.
21.
WAP to create a class TIME and display the time in terms of seconds using copy ,default and parameterized constructors.
22.
WAP to create a class HOTEL and store details of customer when he checks in and delete when he checks out.
JASLEEN
E101045
100180305180
TASK 23: : Create a class Computer with data members (Speed, RAM,
Hard_disk) and member functions as (getspeed(),setspeed(),getram(),setram(),getharddisk(),setharddisk()) . Derive a class Laptop from the above mentioned class with additional data members(Battery, Weight) and member functions as(getbattery(), setbattery(), getweight(),setweight()). Show all the details of the base class as well as the class Laptop. Use appropriate visibility scope.
SOURCE CODE:
#include<iostream.h> #include<conio.h> class computer { protected: int speed; float ram; int hard_disk; public: void getspeed(){ cout<<"enter the speed of computer in kb/sec"<<endl; cin>>speed; } void putspeed() { cout<<"speed is kb/sec"<<speed<<endl;
JASLEEN E101045 100180305180
} void getram() { cout<<"enter ram of computer in GB"; cin>>ram; } void putram() { cout<<"ram is (in GB)"<<ram<<endl; } void gethard_disk() { cout<<"enter the harddisk in GB"<<endl; cin>>hard_disk; } void puthard_disk() { cout<<"harddisk is (in GB)"<<hard_disk<<endl; } }; class laptop:public computer{ protected:
JASLEEN
E101045
100180305180
int battery; float weight; public: void getbattery() { cout<<"enter the battery back up of laptop(in hours)"<<endl; cin>>battery; } void putbattery() { cout<<"the battery back up of lappy is (in hours)"<<battery<<endl; } void getweight() { cout<<"enter the weight of lappy in kg"<<endl; cin>>weight; } void putweight()
JASLEEN
E101045
100180305180
{ cout<<"weight of lappy in kg is"<<weight<<endl; } void update_ram(float x) { ram=ram+x; cout<<endl; cout<<"new ram is"<<ram<<endl; } }; main() { int i,n; laptop obj[10]; cout<<"enter the number of laptops"<<endl;
JASLEEN
E101045
100180305180
obj[i].getspeed();
obj[i].gethard_disk();
obj[i].getweight();
obj[i].getbattery();
JASLEEN
E101045
100180305180
int ch; cout<<"press 1 for documentation 2 for multimedia 3 for hd games"<<endl; cin>>ch; switch(ch) { case 1: { float temp=(float)100/(1024*1024); obj[i].update_ram(temp); break; } case 2: { float temp=100/1024;
JASLEEN
E101045
100180305180
JASLEEN
E101045
100180305180
obj[i].putbattery(); } getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
TASK 24: Create a class Student with data members (Name, Roll_no) of the
student. Derive a class Internal from it which has data members (Int1, Int2) and member functions which fetch & display the details of a student as well as marks. Create a class External with data members ( Ext1, Ext2) and member function to fetch & display the external marks. Create a new class Total derived from internal & external to find the total of student and display it.
SOURCE CODE:
#include<iostream.h> #include<conio.h> class student { char name[50]; int rollno; public: void getdata(); void showdata(); }; class internal:public student { protected: int maths; int eng; int sci;
JASLEEN
E101045
100180305180
public: void getdata(); void showdata(); }; class external { protected: int maths1; int eng1; int sci1; public: void getdata(); void showdata(); }; class total: public external,public internal { protected: int sum; public:
cin>>name; cout<<endl; cout<<"enter roll no."; cin>>rollno; cout<<endl; } void student::showdata() { cout<<"name of student is "; cout<<name<<endl; cout<<"roll no"; cout<<rollno<<endl; } void internal::getdata() { cout<<"enter the internal marks of subject"; cout<<"maths:"; cin>>maths; cout<<"eng"; cin>>eng; cout<<"science"; cin>>sci;
JASLEEN
E101045
100180305180
} void internal::showdata() {
cout<<"internal marks are"<<endl; cout<<"maths "<<maths<<endl; cout<<"eng "<<eng<<endl; cout<<"sci "<<eng<<endl; } void external::getdata() { cout<<"enter the external marks of subject"; cout<<"maths:"; cin>>maths1; cout<<"eng"; cin>>eng1; cout<<"science"; cin>>sci1; } void external::showdata() { cout<<"external marks are";
JASLEEN
E101045
100180305180
sum=maths+eng+sci+maths1+eng1+sci1; cout<<"total marks are "<<sum<<endl; } main() { total obj[50]; int n,i; cout<<"enter the total number of students";
JASLEEN E101045 100180305180
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180
S.NO.
TITLE
PAGE NO.
DATE
REMARKS
23.
24.
25.
JASLEEN
E101045
100180305180
TASK 25: Crate a class Fest with data members (Names_of_events , timings)
and appropriate functions of class. Derive a DSW from fest which has data members(Faculty_Incharge for an event).Derive a class Student_Head from DSW with data members (Name , Roll_no, Contact_no ) of the student. Display all the details of all the events of the fest.
SOURCE CODE:
#include<iostream.h> #include<conio.h> class fest { char name[50]; int time; public: void getdata(); void showdata(); }; class dsw:public fest{ char facultyname[50]; public:
JASLEEN
E101045
100180305180
void getdata(); void showdata(); }; class student:public dsw { char name[50]; int rollno; long int contact; public: void getdata(); void showdata(); }; void fest::getdata() { cout<<"enter the name of the fest"; cin>>name; cout<<"enter the time"; cin>>time; }
JASLEEN
E101045
100180305180
void fest::showdata() { cout<<"name of fest is "<<name<<endl; cout<<"would start at "<<time<<endl; } void dsw::getdata() { fest::getdata(); cout<<"enter the name of faculty"; cin>>facultyname; } void dsw::showdata() { fest::showdata(); cout<<"name of faculty head is "<<facultyname; } void student::getdata() { dsw::getdata();
JASLEEN
E101045
100180305180
cout<<"enter the name student"; cin>>name; cout<<"enter the roll no"; cin>>rollno; cout<<"enter his/her contact no."; cin>>contact; } void student::showdata() { dsw::showdata(); cout<<" the name student"; cout<<name<<endl; cout<<" the roll no"; cout<<rollno<<endl; cout<<" his/her contact no."; cout<<contact<<endl; } main() {
JASLEEN
E101045
100180305180
student obj[50]; int i,n; cout<<"enter the number of fests"; cin>>n; for(i=0;i<n;i++) { obj[i].getdata(); obj[i].showdata(); fflush(stdin); } getch(); }
JASLEEN
E101045
100180305180
OUTPUT:
JASLEEN
E101045
100180305180