CPP Index
CPP Index
CPP Index
NAME: ________________________________________________
ROLLNO: ___________ DIV: ________ DATE: _________________
SUBJECT: _______________________ YEAR : _________________
INDEX
Sr. Description Page
No. No.
Create a class called Car with data members like name, company,
noofseats, fueltype, and price. Include member functions setCar() to
initialize the members with suitable values and showCar() to display car
2. details in appropriate format. 7
Create a class called Book that contains data members such as bookno
(an int), title(array of char), author (array of char) and price (type float).
Include a member function called addbook() to get book details from the
user, and another function called showbooks() to display all the details.
Finally create a member function sortByTitle(), that will sort the data for
all the items in the ascending order of book title. Write a menu driven
program to exercise this class. Invite the user to input data for up to 5-10
3. Books. 9
Write the definition for a class called complex that has floating point data
members for storing real and imaginary parts. The class has the
following member functions: void set(float, float) to set the specified
value in object void disp() to display complex number object complex
sum(complex) to sum two complex numbers & return complex number
1. Write the definitions for each of the above member functions.
2. Write main function to create three complex number objects. Set the
value in two objects and call sum() to calculate sum and assign it in third
6. object. Display all complex numbers. 20
____________________________
SIGNATURE OF SUBJECT FACULTY