TUTORIAL LAB REPORT
INTRODUCTION:
Programming is the backbone of modern technology, enabling us to instruct computers to perform
specific tasks efficiently. This tutorial manual is designed to introduce and strengthen
fundamental programming concepts using two widely-used languages: C++ and Python.
C++ is a powerful, high-performance programming language commonly used in system/software
development and embedded programming. It supports both procedural and object-oriented
programming (OOP), making it ideal for teaching structured coding, functions, memory
management, and OOP principles like inheritance, polymorphism, and encapsulation.
Python, on the other hand, is known for its simplicity and readability. It is an interpreted, high-
level programming language suitable for beginners as well as professionals. Python finds
applications in data science, automation, web development, artificial intelligence, and more.
This manual provides a step-by-step guide covering essential C++ topics, including basic syntax,
control structures, functions, matrices, sorting/searching algorithms, and core OOP concepts. It
then introduces Python programming with a focus on simple, real-world applications. Two
example programs—one in C++ and one in Python—are included to demonstrate the practical
use of the concepts discussed.
CONTENTS:
• Basic Statements in C++
• Functions in C++
• User-Defined Functions
• Multi-Dimensional Matrix Operations
• Sorting Techniques
• Searching Techniques
• Object-Oriented Programming Basics
• Constructors and Destructors
• Function Overloading
• Inheritance
• Polymorphism and Virtual Functions
• Pointers
• Introduction to Python
• Python Calculator Design
SUMMARY
1. REVIEW AND IMPLEMENTATION OF BASIC STATEMENTS IN C++
Summary:
This topic introduces fundamental syntax in C++, including variables, data types, input/output using
cin and cout, and control structures like if-else, for, while, and switch.
PROGRAM: Simple Input and Output
OUTPUT:
PROGRAM: Even or Odd
OUTPUT:
2. IMPLEMENTATION OF FUNCTIONS IN C++
Summary:
Functions help break a program into smaller, manageable tasks. C++ supports user-defined functions
with or without return values and parameters, enhancing modularity and readability.
PROGRAM: Function to Add Two Numbers
OUTPUT:
PROGRAM: Function to Calculate Area of Circle
OUTPUT:
3. IMPLEMENTATION OF USER-DEFINED FUNCTIONS IN C++
Summary:
User-defined functions in C++ allow the programmer to structure code for clarity and reuse. It’s the
foundation of organized software development.
PROGRAM: Check Prime Number
OUTPUT:
PROGRAM: Factorial Using Function
OUTPUT:
4. MULTI-DIMENSIONAL MATRIX OPERATIONS
Summary:
This section focuses on using 2D arrays to perform basic arithmetic operations such as addition,
subtraction, and multiplication, useful in scientific and engineering applications.
PROGRAM: Matrix Addition
OUTPUT:
PROGRAM: Matrix Multiplication
OUTPUT:
5. SORTING TECHNIQUES IN C++
Summary:
Sorting algorithms like Bubble Sort, Selection Sort, and Insertion Sort arrange data in ascending or
descending order, improving data handling and search performance.
PROGRAM:. Bubble Sort
OUTPUT:
PROGRAM: Selection Sort
OUTPUT:
6. SEARCHING TECHNIQUES IN C++
Summary:
Searching algorithms like Linear Search and Binary Search are used to find specific data within
arrays, with Binary Search being faster on sorted data.
PROGRAM: Linear Search
OUTPUT:
PROGRAM: Binary Search
OUTPUT:
7. BASIC CONCEPTS OF OBJECT-ORIENTED PROGRAMMING (OOP)
Summary:
C++ supports OOP principles like classes, objects, encapsulation, and abstraction. OOP makes code
reusable, scalable, and easier to manage.
PROGRAM: Basic Class and Object
OUTPUT:
PROGRAM: Private and Public Access
OUTPUT:
8. CONSTRUCTORS AND DESTRUCTORS
Summary:
Constructors initialize objects automatically upon creation. Destructors clean up resources. Both are
special functions within a class in C++.
PROGRAM: Default Constructor
OUTPUT:
PROGRAM: Destructor
OUTPUT:
9. FUNCTION OVERLOADING
Summary:
Function Overloading allows multiple functions with the same name but different parameters,
increasing flexibility and readability of code.
PROGRAM: Overload add()
OUTPUT:
PROGRAM: Overload display()
OUTPUT:
10. INHERITANCE
Summary:
Inheritance lets a class (child) acquire properties and methods of another class (parent). It supports
reusability and hierarchical classification.
PROGRAM: Single Inheritance
OUTPUT:
PROGRAM: Multilevel Inheritance
OUTPUT:
11. POLYMORPHISM AND VIRTUAL FUNCTIONS
Summary:
Polymorphism enables functions to behave differently based on the object that calls them. Virtual
functions allow dynamic method resolution at runtime.
PROGRAM: Runtime Polymorphism with Virtual Function
OUTPUT:
PROGRAM: Virtual Function with Base and Derived Class
OUTPUT:
12. POINTERS IN C+
Summary:
Pointers store memory addresses and are used in dynamic memory management, arrays, and
function arguments to increase program efficiency.
PROGRAM: Pointer to Variable
OUTPUT:
PROGRAM: Pointer to Function
OUTPUT;
13. INTRODUCTION TO PYTHON
Summary:
Python is a high-level, interpreted language known for its readability and simplicity. It uses
indentation to define blocks and supports dynamic typing.
PROGRAM: Basic Input/Output and Data Types
OUTPUT;
PROGRAM: If-Else and Loops
OUTPUT:
14. DESIGN OF SIMPLE CALCULATOR USING PYTHON
Summary:
This involves creating a user-interactive program to perform arithmetic operations like addition,
subtraction, multiplication, and division using Python.
PROGRAM: Calculator Using If-Else
OUTPUT:
PROGRAM: Calculator Using Functions
OUTPUT:
CONCLUSION
In this tutorial manual, we have explored and implemented the
fundamental and advanced concepts of programming using both C++ and Python.
Starting from the basics—such as syntax, input/output, and functions—we gradually
moved toward more complex topics including arrays, object-oriented programming,
pointers, inheritance, and polymorphism.
Through step-by-step explanations and full program examples, we have gained
hands-on experience in how different features of C++ work together to build
structured and modular applications. By implementing sorting and searching
algorithms, we practiced real-world problem-solving approaches and learned how to
optimize logic.
In the later sections, we introduced Python, highlighting its simplicity and how it can
be used for quick development tasks. Projects like the simple calculator helped us
apply logic in a new language environment and broaden our programming
perspective.
Key highlights of what we achieved:
• Learned structured and object-oriented programming using C++
• Understood the role of functions, classes, inheritance, polymorphism, and
memory management
• Practiced logic-building through sorting/searching and matrix operations
• Transitioned to Python and implemented a practical calculator project
• Developed a deeper understanding of how C++ and Python can solve real-world
problems
This manual serves as a foundational guide, and with the skills we’ve developed here,
we are now prepared to advance into more complex software projects and
development fields confidently.
>>>>>>>>>>>>>>>>>>>>>>GOOD LUCK<<<<<<<<<<<<<<<<<<<