0% found this document useful (0 votes)
3 views1 page

Function Overloading in C++

The document contains a C++ program that demonstrates function overloading by defining multiple 'add' functions for different parameter types and counts. It includes functions to add two integers, two floats, and three integers, each printing the result. The main function calls these overloaded 'add' functions with appropriate arguments.

Uploaded by

berserrk98
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)
3 views1 page

Function Overloading in C++

The document contains a C++ program that demonstrates function overloading by defining multiple 'add' functions for different parameter types and counts. It includes functions to add two integers, two floats, and three integers, each printing the result. The main function calls these overloaded 'add' functions with appropriate arguments.

Uploaded by

berserrk98
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

#include <iostream>

using namespace std;

void add(int a, int b) {


cout << "Sum of two integers: " << a + b << endl;
}

void add(float a, float b) {


cout << "Sum of two floats: " << a + b << endl;
}

void add(int a, int b, int c) {


cout << "Sum of three integers: " << a + b + c << endl;
}

int main() {
add(5, 10);
add(4.5f, 5.5f);
add(2, 4, 6);
return 0;
}

You might also like