Wednesday, April 7, 2021

Program without using function templates (OOP) (40)

#include<iostream>

using namespace std;

void sum(int x,int y)

{

cout<<x<<"+"<<y<<"="<<x+y<<endl;

}

void sum(double x,double y)

{

cout<<x<<"+"<<y<<"="<<x+y<<endl;

}

void sum(double x,int y)

{

cout<<x<<"+"<<y<<"="<<x+y<<endl;

}

void sum(int x,double y)

{

cout<<x<<"+"<<y<<"="<<x+y<<endl;

}

int main()

{

sum(2,3);

    sum(2.5,3.6);

    sum(7.8,3);

sum(2,3.8);

} 

No comments:

Post a Comment