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
Why do we use class in oops?
What are main features of oop?
What type of loop is a for loop?
What is class and object in oops?
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
can inline function declare in private part of class?
What is persistence in oop?
What is overriding in oop?
How do you define social class?
What does and I oop mean in text?
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
What is polymorphism and types?
What is abstraction and encapsulation?
when to use 'mutable' keyword and when to use 'const cast' in c++