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 is encapsulation in simple terms?
What is polymorphism what are the different types of polymorphism?
What is a null tree?
What is encapsulation example?
What is the difference between procedural programming and oops?
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< What are different oops concepts? What is object in oop with example? What are the benefits of interface? What is for loop and its syntax? How oops is better than procedural? What is a function in oop? What are benefits of oop? What is abstraction encapsulation? What is the full form of oops?