Function Overloading - Insurance Tips

A Hub of Best Guide Health Insurance Tips

Saturday, March 28, 2020

Function Overloading

#include
#include
using namespace std;

void sum(int, int, int, int);
void sum(int, int, int);
void sum(int, float);

int main()
{
    int a, c, d;
    float b;
    cout<<"Enter value of a of type integer: ";
    cin>>a;
    cout<<"Enter value of b of type float:   ";
    cin>>b;
    cout<<"Enter value of c of type integer: ";
    cin>>c;
    cout<<"Enter value of d of type integer: ";
    cin>>d;
    cout<    sum(a, b, c, d);
    sum(a, b, c);
    sum(a, b);
    getch();
}
void sum(int a, int b, int c, int d)
{
     cout<<"a+b+c+d   (in integers)     = "<}
void sum(int a, int b, int c)
{
     cout<<"a+b+c     (in integers)     = "<}
void sum(int a, float b)
{
     cout<<"a+b     (in floating point) = "<}

No comments:

Post a Comment