C++ Programs List (Self Study)

List of C++ Programs For Self Study 

1).Create a class cricketer that holds the name, date-of-birth, no-matches etc., of each cricketer. Include the virtual functions to set and retrieve values. Inherit the class cricketer to create a class batsman that stores the number of 100’s, 50’s of the batsman and a class bowler that holds the total-wickets, no-maiden-overs of the bowler. Include function to set and retrieve values in both classes.

2).Create a class Person that stores the name, address and date of birth of the person. Include functions to set and display values. Also include the function older() that returns the person older amongst the two person

3).Create a class Point that consists of an x and a y coordinate. From this base class, derive a class named Circle that has an additional data member named radius. For this derived class, x and y are the center coordinates. Include the member functions to set, display the values. Also include the function to find the area. Include getDistance function in Point class and find the distance between two circles. Achieve runtime polymorphism

distance = V sqr (x2 – x1) + sqr( y2 – y1)

4).Define a class faculty with the attributes like: name of the faculty member, qualification, subjects he/she can teach. Inherit the faculty class into a regular faculty and visiting faculty. The regular faculty is available full time, teach at least 3 subjects. While visiting faculty is available for 2 or 3 days only and teaches a single subject. Provide virtual functions for reading and writing class objects of both the classes. Also create few objects of each of them.

5).Create a class employee with the attributes name, address, date-of-birth, salary etc., Include the function to set and get the values of attributes, which should be declared virtual. Inherit this class to create class Manager and Clerk. Include the function to set and get values, which calls the base class function. Create an array of pointers to the class employee. Depending upon user’s choice for creating a Manager or Clerk, objects must be created.

6).Create a class Cuboid that holds the dimension of cuboid. Also include the methods to set and retrieve methods. Both the methods should be virtual. Inherit this class to create a class Room that holds the no-windows, total-furniture-cost. Using the pointer to the class cuboid access the object of living-room.




Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.