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
Which is better struts or spring?
What is class in oop with example?
How do you define a class in oop?
What is polymorphism give a real life example?
What is a null tree?
What is overriding vs overloading?
What is protected in oop?
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
What is advantage of inheritance?
What is the highest level of cohesion?
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
Prepare me a program for the animation of train
Which is not an object oriented programming language?
what type of question are asked in thoughtworks pair programming round ?
What is oops and its features?