write a program in c++ to overload the function add (s1,s2)
where s1 and s2 are integers and floating point values.

Answer Posted / vaibhav munde

#include<iostream.h>
#include<conio.h>
int add(int s1,int s2)
{
return(s1+s2);
}
float add(float a,float b)
{
return(a+b);
}
void main()
{
int s,s1,s2;
float a,b,c;
clrscr();
cout<<"\n Enter two integer number:";
cin>>s1>>s2;
s=add(s1,s2);
cout<<"Addition of two Integer number:"<<s;
out<<"\n Enter two float number:";
cin>>a>>b;
c=add(a,b);
cout<<"Addition of two Float number:"<<c;
getch();

}

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is enum a class?

608


Get me a number puzzle game-program

1696


What is the point of oop?

661


Why do we need polymorphism in c#?

695


What are two types of polymorphism?

616






Why do we use class?

638


Write a c++ program to display pass and fail for three student using static member function

2820


What is the oops and benefits of oops programming?

558


write a C++ program for booking using constructor and destructor.

2055


Advantage and disadvantage of routing in telecom sector

790


Why is polymorphism important in oop?

637


Are polymorphisms mutations?

707


Why is object oriented programming so hard?

618


State what is encapsulation and friend function?

703


write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

1795