DSA-LAB_01(Recall C++ programming)
DSA-LAB_01(Recall C++ programming)
Objective:
Recall C++ programming and demonstrate C++ classes and templates using Code Blocks .
Theory:
In order to give a quick review of C++, Rectangle Class (class Declaration, Member function
definition, calling) is demonstrated in the lab.
Declare a class Rect, with data members: length, breadth, area, and perimeter.
Declare member functions to accept input and compute area and perimeters:
input(), ComputeArea(), ComputePeri(), Display()
Write a main function:
instantiate the class by passing appropriate arguments to the constructor
invoke ComputeArear(), ComputePeri() and Display() functions
Program in C++ :
Practical # 01 Page 1 of 2
OUTPUT:
5. Write a program to display the average of three numbers entered by the user by
creating a class named 'Average' having a function to calculate and display the
average..
_____________________________________________________________________________________________
___________________________________________________________________________________________
6. Write a program to display the sum, difference and product of two complex numbers
by creating a class named 'Complex' with separate functions for each operation
whose real and imaginary parts are entered by the user.
____________________________________________________________________________________________
___________________________________________________________________________________________
Name: _____
Roll #: _____
Date: _____
Subject Teacher
Remarks:
Practical # Page 2 of 2
01