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
Is enum a class?
Get me a number puzzle game-program
What is the point of oop?
Why do we need polymorphism in c#?
What are two types of polymorphism?
Why do we use class?
Write a c++ program to display pass and fail for three student using static member function
What is the oops and benefits of oops programming?
write a C++ program for booking using constructor and destructor.
Advantage and disadvantage of routing in telecom sector
Why is polymorphism important in oop?
Are polymorphisms mutations?
Why is object oriented programming so hard?
State what is encapsulation and friend function?
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.