Professional Documents
Culture Documents
Function overloading
Software and Hardware Used - 12th Gen Intel® Core™ i3-12100 3.30 GHz 64-
bit operating system, x64-based processor.
Theory –
Function Overloading is defined as the process of having two or more function with the same
name, but different in parameters is known as function overloading in C++. In function
overloading, the function is redefined by using either different types of arguments or a different
number of arguments. It is only through these differences compiler can differentiate between the
functions.
Code -
#include <iostream>
Sakshi singh
2237834
CEC,CGC LANDRAN DEPARTMENT OF IT
int main() {
int p,q,r,s,t;
std::cout<<"Enter the value of a,b,c: "<<std::endl;
std::cin>>p>>q>>r;
std::cout<<"Enter the value of d,e: "<<std::endl;
std::cin>>s>>t;
std::cout << "Product of " << p << " and " << q << " is " << prd1 << std::endl;
std::cout << "Sum of " << p << ", " << q << ", and " << r << " is " << sum2 << std::endl;
std::cout << "Sum of " << s << " and " << t << " is " << sum3 << std::endl;
return 0;
}
Sakshi singh
2237834
CEC,CGC LANDRAN DEPARTMENT OF IT
Output –
Sakshi singh
2237834