0% found this document useful (0 votes)
15 views15 pages

Complete Oop Lab File 2

The document outlines a series of lab experiments focused on implementing various C++ classes and functionalities, including Matrix, Complex numbers, custom memory allocation, class hierarchies, dynamic polymorphism, templates for linked lists and sorting algorithms, and stack and queue classes with exception handling. Each experiment has a specific objective and requires coding implementations to achieve the desired outcomes. Additionally, there is a complex number file operations program that generates and processes random complex numbers in a file format.

Uploaded by

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

Complete Oop Lab File 2

The document outlines a series of lab experiments focused on implementing various C++ classes and functionalities, including Matrix, Complex numbers, custom memory allocation, class hierarchies, dynamic polymorphism, templates for linked lists and sorting algorithms, and stack and queue classes with exception handling. Each experiment has a specific objective and requires coding implementations to achieve the desired outcomes. Additionally, there is a complex number file operations program that generates and processes random complex numbers in a file format.

Uploaded by

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

Lab Experiment 2: Matrix Class Implementation

Objective:
To implement a Matrix class in C++ using dynamic memory, constructors, a destructor, a copy
constructor, and assignment operator overloading.

Code:

Output:
Lab Experiment 3: Complex Number Class
Objective:
To create a Complex class in C++ that supports arithmetic operations, allows type conversions, and
displays complex numbers.

Code:

Output:
Lab Experiment 4: Custom Memory Allocation with new and delete
Objective:
To overload the new and delete operators in C++ for a custom memory allocation in a class.

Code:

Output:
Lab Experiment 5: Class Hierarchy for Inheritance Types
Objective:
To create a C++ class hierarchy that demonstrates different types of inheritance: single, multiple,
multilevel, and hierarchical inheritance.

Code:

Output:
Lab Experiment 6: Demonstrating Dynamic Polymorphism and RTTI
Objective:
To create a C++ test application that demonstrates dynamic polymorphism and Runtime Type
Identification (RTTI). This program will utilize base and derived classes to show polymorphic behavior
and identify object types at runtime.

Code:

Output:
Lab Experiment 7: Template for a Linked List Class in C++
Objective:
To create a template-based Linked List class in C++ that can store elements of any data type, with
methods to perform basic operations like adding, removing, and displaying nodes.

Code:
Output:
Lab Experiment 8: Templates for Standard Sorting Algorithms in C++
Objective:
To create template-based implementations of standard sorting algorithms, including Bubble Sort,
Insertion Sort, and Quick Sort in C++, allowing these algorithms to work with different data types.

Code:
Output:
Lab Experiment 9: Stack and Queue Classes with Exception Handling in
C++
Objective:
To implement Stack and Queue classes in C++ with exception handling to manage errors such as
overflow and underflow conditions.

Code:
Output:
Lab Experiment 10: Complex Number File Operations with Random
Generation in C++
Objective:
To create a C++ program that generates random complex numbers, writes them to a file in pairs with a
random operator between them, and reads the file line by line.

Code:
File Writing Program:
This program generates complex numbers in the format (a + bi), pairs them with an operator, and writes
them to a file.

File Reading Program:


This program reads and displays each line from the file.
Combined Code:

Output:
This program creates a file with lines like:
And displays these lines on the console upon reading.

You might also like