44892757-Assignment-Solved - Copy

44892757-Assignment-Solved - Copy - Mail your solutions to

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Mail your solutions to sandeep.jain@jiit.ac.in by 31 st October. Use the following pattern for subject of the mail. HIMANSHU GOEL || 9909103424 || OOPS ASSIGNMENT Question 1: There are several publishers located at different cities in India. Each publication house has some star authors, some known authors and some local/unknown authors. Authors are experts of different areas. One author may be an expert of maximum 3 areas. Authors responsibility is to write books in their area. Books will be of different pages, and written in different years. Books price may vary. Publication house maintains the records of no of copies sold in a year. Identify the classes and their relationships. Write a program to implement your classes and identified relationships. Further your program should display, Name of Book and the Author of the book having highest sale in a year. Question 2: Write a class in C++ representing a one dimensional Array of integer. Design suitable  member functions to add, delete a value from array, sort array using insertion sort and search a value in  the array using binary search. Operations should invoke at runtime based on user choice. Write a menu  driven main to demonstrate all functions of an array class.  Write at least three inputs with which you  have tested your class. Question 3:- Consider the following code: #include<iostream.h> #include<conio.h> #include<dos.h> void pos(int,int); class stg { private: char *p; public: stg(char *temp) { p=temp; disp; } void disp()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
{ pos(10,30); cout<<p; } }; void main() { stg s1="ab cd"; stg s2="fgbg"; getch(); } void pos(int row,int col) { union REGS i; i.h.ah=0x02; i.h.bh=1; i.h.dh=row; i.h.dl=col; int86(0x10,&i,&i); } (a) Correct an error (if any) (b) Explain the output: (i) On changing values of i.h.bh and i.h.ah (ii) On multiple execution after changing these values. Ans. Correct prog. #include<iostream.h> #include<conio.h> #include<dos.h> void pos(int,int); class stg { private: char *p; public: stg(char *temp) { p=temp; disp(); // it was earlier error } void disp()
Background image of page 2
{ pos(10,30); cout<<p; } }; void main() { stg s1="himanshu"; stg s2="goel"; getch(); } void pos(int row,int col) { union REGS i; i.h.ah=0x02; i.h.bh=1; i.h.dh=row; i.h.dl=col; int86(0x10,&i,&i); } (b) (i) no effect of value like 0x02,0x03,0x07 or any that I can try (ii) himanshugoel himanshugoel himanshugoel This type is not face in dev c++ because there is no function like clrscr() every time program execute there exist a fresh screen, thus don’t lead to multiple execution . Question 4: Consider the following code #include<iostream.h> #include<conio.h> #include<string.h> class test { char e_name[20]; int e_age; public: test() { disp();
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cout<<endl<<"test constructor"; } disp() { test1(); cout<<endl<<"display function"; } test1() { cout<<endl<<"test1 function"; } test(char *name,int age) { strcpy(e_name,name); e_age=age; } test1(char *name,int age) { strcpy(e_name,name);
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 46

44892757-Assignment-Solved - Copy - Mail your solutions to

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online