CLASSES & OBJECT #include class acc { int acc_no; char name[30]; float balance; static float rate; public: void create_acc() { cout<>acc_no>>name; balance=0; } void deposit() { float d; cout<>d; balance=balance+d; } void withdraw() { float w; cout<>w; balance=balance-w; } void calint() { float si; float rate=9.0; si=(balance*rate)/100; balance=balance+si; } void display() { cout<<"\nAcc No="<>c; acc a1[10]; for(int i=0;i<10;i++) { a1[i].create_acc(); a1[i].deposit(); a1[i].withdraw(); a1[i].calint(); a1[i].display(); } } -------------------------------------------------- #include class iteam { int no; float cost; public: void getdata(int a,float b); void putdata(void) { cout <<"\nNUMBER=" <>m>>n; } void set::display (void) { cout <<"\nLargest value=" < class A { public: void show(); void show(int); }; void A::show() { cout <<"\nKHUSHBU"; } void A::show(int x) { int i; for(i=1;i<=x;i++) cout <<"\n\nKHUSHBU"; } void main() { A a1; a1.show(); a1.show(5); } ------------------------------------ #include class k { public: void show(int =1); }; void k :: show(int x) { int i; for(i=0;i class iteam { int no; float cost; public: void getdata(int a,float b); void putdata(void) { cout <<"\nNUMBER="< class iteam { int no; float cost; public: void readdata(int ,float); void calamt(void)const; }; void iteam::readdata(int i,float c) { no=i; cost=c; } void iteam::calamt(void)const { cout <<"\nNUMBER=" < class a; class b { int j; public: void setdata(int y) { j=y; } void sum(a aobj); }; class a { int i; public: void setdata(int x) { i=x; } friend void b::sum(a aobj); }; void b ::sum(a aobj) { cout <<"\n" < class rect { public: class distance { int feet; float inches; public: void setdata(); void showdata(); }; void setrecord(); void showrecord(); private: distance length; distance width; }; void rect::distance::setdata() { cout <<"\nenter feet & inches"; cin >>feet>>inches; } void rect::distance::showdata() { cout <<"FEET=" < class A { int x; public: A() { cout <<"\nConstructor of class a called"; } void setx(int y=0) { x=y; } int getx() { return x; } ~A() { cout <<"\nDestructor of class a called"; } }; void main() { A A1; A1.setx(110); cout<<"\n"< class distance { int feet; float inches; public: distance(int x,float y) { feet=x; inches=y; } int getfeet(void) { return feet; } float getinches(void) { return inches; } }; void main() { int f; float i; cout<<"\nEnter feet & inches\n"; cin>>f>>i; distance d1(f,i); cout<<"\nFEET="<>m>>n; matrix A(m,n); cout<<"Enter matrix element row wise"<>val; A.setdata(p,q,val); } } cout<<"\n-------------\n"; A.display(2,2); } ---------------------------------------------- MULTI #include class multy { float x,y; public: multy(void); float display(void); }; multy::multy(void) { cout<<"\nEnter 1st no"; cin>>x; cout<<"\nEnter 2nd no"; cin>>y; } float multy::display() { float z; z=x*y; return z; } void main() { multy m1; cout<<"\nMULTIPLICATION="< class integer { int m; public: integer(void); integer(int); int display(void); int display1(void); }; integer::integer() { m=0; } integer::integer(int a) { m=a; } int integer::display() { return m; } int integer::display1() { return m; } void main() { integer i1; cout<<"\n"< #include class string { char *sptr; int length; public: string() { length=0; sptr=new char[length+1]; } string(char *s) { length=strlen(s); sptr=new char[length+1]; strcpy(sptr,s); } void display(void) { cout<<"\nName="< #include class string { char *s; int l; public: string() { l=0; s=new char[l+1]; } string(char *a) { l=strlen(a); s=new char[l+1]; strcpy(s,a); } void join(string s1,string s2) { l=s1.l+s2.l; s=new char[l+1]; strcpy(s,s1); strcat(s,s2); } ~string() { delete [] s; cout<<"\nMemory deallocated"; } }; void main() { string s1("OOPs"); string s2("Unix"); string s3(); s3.join(s1,s2); } ------------------------------------- ============================================ ** Dynamic memory CH-3 #include class distance { int feet; float inches; public: void setfeet(int); int getfeet(void); void setinches(float); float getinches(void); }; void distance ::setfeet(int x) { feet=x; } void distance ::setinches(float y) { inches=y; } int distance::getfeet (void) { return feet; } float distance::getinches(void) { return inches; } void main() { int a,i; float b; distance *dptr; int size; cout <<"\nEnter no of elements"; cin >>size; dptr=new distance[size]; for(i=0;i>a; cout <<"\nEnter inches"; cin >>b; dptr[i].setfeet(a); dptr[i].setinches(b); } for(i=0;i