Object Oriented Programming with C++ (LABORATORY)

 

Object Oriented Programming with C++ (LABORATORY) - Assignment

1. Write a C++ program to prompt the user to input her/his name and print this name on the screen, as shown below. The text from keyboard can be read by using cin>> and to display the text on the screen you can use cout<<.

2. Write a program in C++ to display various type or arithmetic operation using mixed data type.

3. A Write a C++ program to prompt the user to input 3 integer values and print these values in Reverse [Descending] order.

3. B Write a C++ program to prompt the user to input 3 integer values and print these values in Forward [Ascending] order.

4. Write a program to find greatest from three numbers.

5. Write a program of student mark sheet where Physics, Chemistry and Maths are the subject as input.

6. Define a class "Bank" with following data members Acc-no, Name of Depositor, A/C Balance, Write member function to perform following task. (a) Accept Details (b) Display Details

7. Write a program in C++ to swap two numbers.

8. Write a program in C++ to swap two numbers using reference variable.

9. Write a program in C++ to test the Type Casting.

10. Write a C++ program to read an integer n and prints the factorial of n.

11. Write a C++ program to compute the sum of the specified number of Prime numbers.

12. Write a program in C++ to demonstrate the manipulators.

13. Write a C++ program to demonstrate the use of Friend function in class.

14. Write a C++ program to sort an Array in Ascending order.

15. Write a C++ program to create a class Person which contains data members as P_Name, P_City, P_Contact_Number. Write member functions to accept and display five Persons information.

16. Write a C++ program to create a class Student which contains data members as Roll_Number, Stud_Name, Marks in five subjects. Write member functions to accept Student information. Display all details of student along with a percentage and class obtained depending on percentage. (Use array of objects)

17. Create a C++ class for a student object with the following attributes—roll no, name, number of subjects, marks of subjects. Write member function for accepting marks and display all information of student along with total and Percentage. Display marklist with Use of manipulators.

18. Write a menu driven C++ program using class to perform all arithmetic operation (+, -, *, /) (use inline function).

19. Write a C++ program to find volume of cube, cylinder and rectangle using function overloading.

20. Write a C++ program to find area of triangle, circle, and rectangle using function overloading.

21. Create a class student containing data members: a. Roll_no b. name c. marks1,

marks2, marks3 Write necessary member functions:

a. to accept details of one students

b. to accept details of all students

c. to display details of one student

d. to display details of all students

(Use Function overloading).

22. Write a C++ program using class to check maximum of two integer numbers using Inline function and conditional operator.

23. Create two classes’ dist1 (meters, centimeters) and dist2 (feet, inches). Accept two distances from the user, one in meters and centimeters and the other in feet and inches. Find the sum and difference of the two distances. Display the result in both (meters and centimeters) as well as feet and inches (use friend function).

24. Write a C++ program using class which contains two data members of type integer. Create and initialize the object using default constructor, parameterized constructor and parameterized constructor with default value. Write a member function to display maximum from given two numbers for all objects.

25. Create a class time that contains hours, minute and seconds as data members. Write the member function to overload operator ‘+’ to add two object of type time (Use Parameterized constructor to accept values for time).

26. Write a program in C++ to overload the binary operator “+” (addition).

27. Create class "multi" with 2 data members x and y. Class has multiple constructor and i.e. one default constructor and another parameterized, which receives value of x and y. show() display the value accordingly.

28. WAP to print user-defined in formations using formatting functions. Input or assign strings and numbers and define field width for them. Fill the empty spaces with character and also define size of numerical float values.

29. Create base class called shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called cylinder and rectangle from the base shape. Add to the base class, a member function get_data(), print_data() to initialize base class data members and display_area(), display_perimeter() to compute and display area and perimeter of shape.

30. Implement multiple and hierarchical inheritance. The class Allrounder derives information from both Bowler and Batsman classes which in turn derive information from the class Cricketer. Define all four classes and write a program to create, update and display information contained in Allrounder objects display the object having the highest number of runs.

31. Create a base class Conversion. Derive three different classes Weight (Gram, Kilogram), Volume (Milliliter, Liter), Currency (Rupees, Paise) from Conversion

class. Write a C++ program to perform read, convert and display operations. (Use Pure virtual function).

Create a base class Media. Derive two different classes Book (Book_id, Book_name, Publication, Author, Book_price) and CD (CD_title, CD_price,CD_capacity) from Media.

Write a C++ program to accept and display information of both Book and CD.

(Use pure virtual function).

32. Create a base class Media. Derive two different classes Book (Book_id, Book_name, Publication, Author, Book_price) and CD (CD_title, CD_price, CD_capacity) from Media. Write a C++ program to accept and display information of both Book and CD. (Use pure virtual function)

33. Write a C++ program to read the contents of a text file. Count and display number of characters, words and lines from a file. Find the number of occurrences of a given word present in a file.

34. Write a C++ program to read the contents of a “Sample.txt” file. Store all the uppercase characters in”Upper.txt”, lowercase characters in ”Lower.txt” and digits in “Digit.txt” files. Change the case of each character from “Sample.txt” and store it in “Convert.txt” file.

35. Write a C++ program to divide two numbers using Exception Handing.

Comments