write a program in c++ to overload the function add (s1,s2)
where s1 and s2 are integers and floating point values.
Answer Posted / deepa mathur
include <iostream.h>
void add (int s1, int s2)
{
int s3;
s3= s1 + s2;
cout<<"sum of 2 no. is= "<< s3;
}
void add (float s1, float s2)
{
float s3;
s3 = s1 + s2;
cout<<" sum of 2 no. is= "<< s3;
}
void main
{
void add (int a, int b);
void add (float a, float b);
add(30, 20);
add (30.5, 56.7);
getch();
}
| Is This Answer Correct ? | 47 Yes | 20 No |
Post New Answer View All Answers
Which is not an object oriented programming language?
Can enum be null?
What is the difference between inheritance and polymorphism?
What is the purpose of enum?
explain sub-type and sub class? atleast u have differ it into 4 points?
What is the significance of classes in oop?
What is abstraction and encapsulation?
Why is polymorphism used?
What is polymorphism and example?
What is pointer in oop?
What is a superclass in oop?
What is multilevel inheritance explain with example?
what type of question are asked in thoughtworks pair programming round ?
What is oops and why we use oops?
What are main features of oop?