List of Experiments
List of Experiments
Also add
getdata() and setdata() functions.
2. Write a program to demonstrate operator overloading for addition and subtraction
over two complex numbers.
3. Write a program to demonstrate polymorphism by adding two int numbers, three int
numbers, and one int ad one float.
4. Write a program to demonstrate pre/post increment and decrement where pre/post
increment rather do the operation by increment by 1, it decrements by 1, or vise-
versa,
5. Create class first with data members book no, book name and member function
getdata() and putdata(). Create a class second with data members author name,
publisher and members getdata() and showdata(). Derive a class third from first and
second with data member no of pages and year of publication. Display all these
information using array of objects of third class.
6. Implement a class string containing the following functions:
a. - Overload + operator to carry out the concatenation of strings.
b. - Overload = operator to carry out string copy.
c. - Overload <= operator to carry out the comparison of strings.
d. - Function to display the length of a string.
e. - Function tolower( ) to convert upper case letters to lower case.
f. - Function toupper( ) to convert lower case letters to upper case.
7. Create a class called LIST with two pure virtual function store() and retrieve().To
store a value call store and to retrieve call retrieve function. Derive two classes
stack and queue from it and override store and retrieve.
8. Design three classes STUDENT ,EXAM and RESULT. The STUDENT class has data
members such as rollno, name. create a class EXAM by inheriting the STUDENT
class. The EXAM class adds data members representing the marks scored in six
subjects. Derive the RESULT from the EXAM class and has its own data members
such as totalmarks. Write a program to model this relationship.
9. Create a base class called SHAPE. Use this class to store two double type values.
Derive two specific classes called TRIANGLE and RECTANGLE from the base class.
Add to the base class, a member function getdata to initialize base class data
members and another member function display to compute and display the area of
figures. Make display a virtual function and redefine this function in the derived
classes to suit their requirements. Using these three classes design a program that
will accept driven of a TRINGLE or RECTANGLE interactively and display the area.
10. Create a class TIME with members hours, minutes, seconds. Take input, add two
time objects passing objects to function and display result.