ARUL THARUM VPMM COLLEGE OF
ENGINEERING AND TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
(ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING)
LABORATORY MANUAL
ACADEMIC YEAR: 2026-2027
COURSE CODE: CS25C07
COURSE NAME: OBJECT ORIENTED PROGRAMMING LABORATORY
REGUALATION: R-2025
LAB IN-CHARGE: [Link], AP/CSE
Prepared By Verified By
[Link] AP/CSE Dr.I. SIVA
Principal
SYLLABUS
Course Code COURSE NAME L T P C
CS25C07 OBJECT ORIENTED PROGRAMMING 3 0 4 5
COURSE OBJECTIVES:
• To impart the principles of object-oriented programming and their advantages over procedural
programming.
• To develop problem-solving skills by creating real-world applications using OOP features.
LIST OF EXPERIMENTS
1 a. Write a C++ program using the basic Arithmetic Operators
b. Write a C++ program using Type Conversion
2 a. Write a C++ program to Check Whether a Number is Even or Odd
b. Write a C++ program to Display Numbers from 1 to N using For Loop
3 a. Write a C++ program using Inline Function to Calculate Square of a Number
b. Write a C++ Program using Friend Function to Access Private Data
4 a. Write a C++ Program to Demonstration of Default Constructor
b. Write a C++ Program using Demonstration of Destructor
5 a. Write a C++ Program to demonstrate Single Inheritance
b. Write a C++ Program to demonstrate Multiple Inheritance
6 a. Write a C++ Program using Friend Function to Add Two Objects
b. Write a C++ program that overloads the + operator to add two complex numbers.
7 a. Write a C++ Program access and print the value of a variable using a pointer.
b. Write a C++ Program to demonstrate pointer increment using an array
8 a. Write a C++ Program To demonstrate method overriding using a virtual function
b. Write a C++ Program to show that virtual destructor ensures proper object cleanup
9 a. Write a C++ Program to demonstrate generic programming using a function template
b. Write a C++ Program to create a generic class using templates
10 a. Write a C++ Program To handle division by zero using try–catch block
b. Write a C++ Program To handle invalid array index using exception handling
11 a. Write a C++ program that attempts to open a file and handles the error if the file does not
exist.
b. Write a C++ program that writes data to a file, while checking for file opening/writing errors
12 a. To develop an application that uses classes, objects, constructors, and member functions to
manage student details
b. To develop a simple banking system using OOP features such as classes, member functions,
and encapsulation
Lab Requirements: for a batch of 30 students
Operating Systems: Linux / Windows turbo C/C++, Dev C/C++
TOTAL: 30 PERIODS
COURSE OUTCOMES:
At the end of this course, the students will be able to:
CO 1: Identify basic digital components and their functions in a computer system.
CO 2: Apply Boolean algebra and number systems to design simple digital circuits and simulate
them using tools
CO 3: Analyze instruction sets, arithmetic units, and performance metrics to evaluate processor
design.
CO 4: Engage in continuous learning to update with advancements through evolving computing
trends.
PLAN OF IMPLEMENTATION
Sl. List of Experiments Number Cumula Requir
No of periods t ive ement
planned periods
1 a. Write a C++ program using the basic Arithmetic Operators 5 5 Operat
b. Write a C++ program using Type Conversion ing
2 a. Write a C++ program to Check Whether a Number is Even 5 10 Syste
or Odd ms:
b. Write a C++ program to Display Numbers from 1 to N Linux /
using For Loop Windo
3 a. Write a C++ program using Inline Function to Calculate 5 15 ws turbo
Square of a Number C/C+ +,
b. Write a C++ Program using Friend Function to Access Dev
Private Data C/C++
4 a. Write a C++ Program to Demonstration of Default 5 20
Constructor
b. Write a C++ Program using Demonstration of Destructor
5 a. Write a C++ Program to demonstrate Single Inheritance 5 25
b. Write a C++ Program to demonstrate Multiple Inheritance
6 a. Write a C++ Program using Friend Function to Add Two 5 30
Objects
b. Write a C++ program that overloads the + operator to add
two complex numbers.
7 a. Write a C++ Program access and print the value of a variable 5 35
using a pointer.
b. Write a C++ Program to demonstrate pointer increment
using an array
8 a. Write a C++ Program To demonstrate method overriding 5 40
using a virtual function
b. Write a C++ Program to show that virtual destructor ensures
proper object cleanup
9 a. Write a C++ Program to demonstrate generic programming 5 45
using a function template
b. Write a C++ Program to create a generic class using
templates
10 a. Write a C++ Program To handle division by zero using try– 5 50
catch block
b. Write a C++ Program To handle invalid array index using
exception handling
11 a. Write a C++ program that attempts to open a file and 5 55
handles the error if the file does not exist.
b. Write a C++ program that writes data to a file, while
checking for file opening/writing errors
12 a. To develop an application that uses classes, objects, 5 60
constructors, and member functions to manage student details
b. To develop a simple banking system using OOP features
such as classes, member functions, and encapsulation
Programs Using Operators & Type Conversion
1.a Write a C++ program using the basic Arithmetic Operators
Aim:
To perform basic arithmetic operations on two integers.
Algorithm:
1. Start the program.
2. Declare variables a, b and integer data type.
3. Accept two integer inputs from the user.
4. Compute sum using a + b.
5. Compute difference using a - b.
6. Compute product using a * b.
7. Compute division using a / b.
8. Display all results.
9. End the program.
Program:
#include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Enter two numbers: ";
cin >> a >> b;
cout << "Sum = " << a + b << endl;
cout << "Difference = " << a - b << endl;
cout << "Product = " << a * b << endl;
cout << "Quotient = " << a / b << endl;
}
Output:
Enter two numbers: 10 2
Sum = 12
Difference = 8
Product = 20
Quotient = 5
1.b Write a C++ program using Type Conversion
Aim:
To demonstrate implicit and explicit type conversion.
Algorithm:
1. Start.
2. Declare an integer variable and assign a value.
3. Declare a double variable.
4. Perform implicit conversion by assigning int to double.
5. Perform explicit conversion using (double) variable.
6. Display the converted values.
7. End.
Program:
#include <iostream>
using namespace std;
int main()
{
int x = 10;
double y = x;
cout << "Implicit conversion: " << y << endl;
cout << "Explicit conversion: " << (double)x / 3 << endl;
}
Output:
Implicit conversion: 10
Explicit conversion: 3.33333
2. Programs Using Conditional and Loop Statements
2.a Write a C++ program to Check Whether a Number is Even or Odd
Aim:
To determine whether the given number is even or odd using conditional statements.
Algorithm:
1. Start the program.
2. Declare an integer variable num.
3. Prompt the user to enter a number.
4. Read the value of num.
5. Check if num % 2 == 0.
6. If condition is true, display "Even Number".
7. Else, display "Odd Number".
8. End the program. Program:
Program:
#include <iostream>
using namespace std;
int main()
{
int num;
cout << "Enter a number: ";
cin >> num;
if(num % 2 == 0)
cout << "Even Number";
else cout << "Odd Number";
}
Output:
Enter a number: 7
Odd Number