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.
4. Write a program to
find greatest from three numbers.
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.
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
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
Post a Comment