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

What does oop mean in snapchat?

911


Is html an oop?

761


What are objects in oop?

816


What is object in oop with example?

939


Why is polymorphism needed?

780


what is different between oops and c++

2176


What is polymorphism programming?

831


write string class as your own class in java without using any built-in function

2193


What is new keyword in oops?

771


given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy

2356


Advantage and disadvantage of routing in telecom sector

1005


Can a varargs method be overloaded?

802


What is encapsulation and abstraction? How are they implemented in C++?

834


What are the two different types of polymorphism?

872


• What are the desirable attributes for memory managment?

1934