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
What does oop mean in snapchat?
Is html an oop?
What are objects in oop?
What is object in oop with example?
Why is polymorphism needed?
what is different between oops and c++
What is polymorphism programming?
write string class as your own class in java without using any built-in function
What is new keyword in oops?
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
Advantage and disadvantage of routing in telecom sector
Can a varargs method be overloaded?
What is encapsulation and abstraction? How are they implemented in C++?
What are the two different types of polymorphism?
• What are the desirable attributes for memory managment?