0% found this document useful (0 votes)
58 views2 pages

OOPC LAB MANUAL Htfhyfhvhvhg

The document outlines a practical list for the subject 'Object Oriented Programming using C++' at Kadi Sarva Vishwavidyalaya. It includes a series of programming exercises divided into two practical sets, focusing on basic concepts of C and C++ such as functions, structures, classes, operator overloading, and inheritance. Each exercise aims to reinforce specific programming skills and concepts in C++.

Uploaded by

jiyaparmar1905
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

OOPC LAB MANUAL Htfhyfhvhvhg

The document outlines a practical list for the subject 'Object Oriented Programming using C++' at Kadi Sarva Vishwavidyalaya. It includes a series of programming exercises divided into two practical sets, focusing on basic concepts of C and C++ such as functions, structures, classes, operator overloading, and inheritance. Each exercise aims to reinforce specific programming skills and concepts in C++.

Uploaded by

jiyaparmar1905
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Kadi Sarva Vishwavidyalaya

LDRP Institute of Technology and Research, Gandhinagar


CE/IT/EC Department
Practical List
Subject: OBJECT ORIENTED PROGRAMMING USING C++
Sr no Name of Experiment
Practical set-1 (Basics of C)
1. Write a program to create 4 functions namely add1( ), add2( ), add3( ), add4( ) to
demonstrate the concept of all types of function.
2. Write a program to create an employee structure having member’s name and
salary. Get data in employee structure through one function and display data
using another function. Use concept of structure and function.
3. Write a program to create a person structure having age and weight as structure
members. Get the data and print the data using pointers. Use concept of pointers with
structure.
4. Write a program to swap 2 values of a variables by using pointer
PRACTICAL SET-2 (Basics of C++)
5. Write a program to check whether given number is the prime number or not, using a
member function.
6. Write a program to find out the maximum number in a given array. Using a member
function of class containing an array.
7. Write a program to demonstrate the use of inline functions by creating 2 inline
functions. One inline function for multiplication operation and other inline function
for demonstrating division operation.
8. Write a function power to raise a number m to power n. The function takes a double
value for m and int value for n. Use default value for n to make the function to
calculate squares when this argument is omitted.
9. Write a program that overloads volume functions that return volume of cube, cuboids
and cylinder.
10. Write a program to create a class for book having title, price and publisher having 2
member functions get details( ) and set details( ). Also create the object of 2 different
books, use getter and setter for both the objects.
11. Write a program to create an array of 5 objects for previous program.
12. Write a program to find the maximum price of 2 books and return that book as object.
Use object as function argument.
13. With reference to previous program, add 2 member variables serial_no and
no_of_books (declare both as static variables) in class named books. Create a friend
function getcount( ) to demonstrate the concept of friend function.

14. Write a Program to demonstrate the use of scope resolution.


15. Write a program to create a class for defining COMPLEX numbers and overload
three set functions (setters). The first set function which takes no argument is used to
create objects which are not initialized, second which takes one argument is used to
initialize real and imaginary parts to equal values and third which takes two argument
is used to initialized real and imaginary to two different values. Define a display
function that prints the complex number.
16. Write a program to create a class TEST with one int member. Define constructor,
destructor and getter for the same. Define a function (outside class) find_square that
takes object as an argument and returns square of int member of that object. Also
define destructor.
17. Write a program to perform addition of two complex numbers using constructor
overloading. Define add function outside the class that returns the addition.
18. Write a program to create a class TIME with members hours, minutes, and seconds.
Read values from keyboard and add two TIME objects by passing objects to function
and display result. Also define destructor.
19. Implement a program to demonstrate the concept of operator overloading. Overload
‘+’ and ‘=’ operators.
20. Design three classes STUDENT, EXAM and RESULT. The STUDENT class has
data members namely rollno, name. EXAM is created by inheriting STUDENT.
EXAM class adds data members representing the marks scored in six subjects.
Derive RESULT from EXAM and has its own data member total_marks. Write a
program to model this relationship.
21. 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.
22. Create a function using the concept pointers that swaps the private data values of two
objects of the same class type.
23. Write a program to find the larger of two given numbers in two different classes
using friend function.
24. Write a program to define the function template for calculating the square of given
number with different data types.

You might also like