CSI Pract5 6
CSI Pract5 6
C++ Programming
Practical No. 5
Aim
: To study the function and related terms in C++.
Problem statement
Write a function in c++ to multiply the two
numbers and display the product using function.
Enter the program and verify the execution of
the same on the computer.
Program
// program to multiply two numbers using a function
#include <iostream.h>
// declaring a function
int multi(int a, int b)
{
return (a * b);
}
void main()
{
int p;
// calling the function and storing the returned value in p
p= multi(12, 8);
cout << “12*8= " << p << endl;
}
Practical No. 6
Aim
: To study the overloading of functions in C++.
Problem statement
•Write a program in c++ to calculate the area of
rectangle and circle using the overloading of
functions.
•Enter the program and verify the execution of
the same on the computer.
Function Overloading
•Function overloading is a feature in C++ where two or
more functions can have the same name but
different parameters.