OOP Lab list

B.Sc (Hons.) in CSE
3rd Semester, CSE 520204 ,OOP Lab
Object Oriented Programming Lab list

1 Write a program in C++ that finds the volume of different shape (like rectangle, cylinder, cube) using function overloading.
2 Write a class to represent time that includes the member function to perform the following:
•Take input for time in hours and minutes.
•Add two times.
•Display the time in form hours : minutes.
3 Create a class called COMPLEX that has two private data called real and imaginary. Include member function input() to input real & imaginary values, show() to display complex numbers. Write a program to add and subtract two complex numbers.
4 Write a program to find the largest and smallest number between two numbers of different classes.
5 Using class write a program that would be able to do the following task:
a)To create the vector.
b)To add the value of a two vector
c)To display the vector in the form (ai+bj+ck)
6 Using class write a program that would be able to do the following task:
·To create the vector.
·To modify the value of a given element.
·To multiply by a scale value
·To display the vector in the form (10, 20, 30…….. )
7 Create two classes……….. DB which stores the value distance. DM store distance……and centimetres and DB in feet inches. Write a program that can read the values for the class objects and add one object DM with another object of DM. Use friend function to carry out the addition operation. The object that stores the results may be a DM object Or DB object, depending on the units in which the result are required.

The display should be in the format of feet inches or meter and centimetres depend on the object on display.

8 Define a class string that could work as a user defined string type. Include constructors dynamically that will enable to input a string from keyboard and to initialize an object with a string constant at the time of creation like string s2(“3rd year”). Also include a

member function that adds two strings to make a third string. Write a complete program to implement this class.


9 Create a class called COMPLEX that has two private data called real and imaginary.

Include member function to add two complex objects using operator overloading.

10 Create a class float that contains one float data number. Overload all the four arithmetic operators for two objects.
11 Write a complete C++ program that computes the result of 10 students. In your program you must have two private data members say name and roll. In your program you also have two public member function say getdata() and showdata() and one public data member say marks. You have to calculate the result based upon the marks.
12 Given the following base class :
class area_cl
double height; double width;
Create two derived classes called rectangle and isosceles that inherit area_cl. Have each class include a function area () that returns the area of a rectangle isosceles triangle, as appropriate. Use parameterized constructors to initialize height and width. Write the complete program.
13 Create a class that has two data members for account number and balance. It has two member functions to input data and display it. Also include a member function to transfer money from one account to another. Write the complete C++ program to implement this.
14 Create an abstract base class called shape. Derive class rectangle from the base class
shape and a class cube from the rectangle class.
Data members :   Length, width for class rectangleHeight for class cube
Member function : Area(), print() for class rectangle
Volume(), print() for class cube
Make function print() as virtual and declare as a pure virtual function in the base class. Write a main program to compute the area of rectangle and volume of cube and display the result using base class pointer.
15 Write a C++ program to append/copy the contents of one file to another.
16 Write a C++ program to read two files simultaneously.
17 Write a C++ program to perform the deletion of white spaces such as horizontal tab,
vertical tab, space, line feed, new line and carriage return from a text file and to store the contents of the file without white spaces on another file.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>