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
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 an example of genetic polymorphism?
What is static modifier?
Which method cannot be overridden?
What is pointer in oop?
What does oop mean in snapchat?
What is the oops and benefits of oops programming?
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.
What is encapsulation oop?
What is pure oop?
What does I oop mean?
What is polymorphism programming?
What is oops concept with example?
what are the different types of qualifier in java?
What is data binding in oops?