Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write a program in c++ to overload the function add (s1,s2)
where s1 and s2 are integers and floating point values.

Answers were Sorted based on User's Feedback



write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floati..

Answer / 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

write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floati..

Answer / rose

include<iostream.h>

class overload
{
void add (int a, int b){
int c;
int c= a+b;
}
void add( float a,float b){
double c;
double c = a+b;}
}
void main()
{overload o = new overload();
o.add(10,20);
o.add(1.2,34.56);
getch();
}

Is This Answer Correct ?    14 Yes 10 No

write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floati..

Answer / 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

write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floati..

Answer / shubham hajare

#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
class stud
{
public:
void add(int a,int b)
{
cout<<a+b;
}

void add(float a,float b)
{
cout<<a+b;
}

void add(int a,float b)
{
cout<<a+b;
}


};
void main()
{
stud a;
a.add(12,12);
a.add(1.2,1.2);
a.add(12,12.2);
_getch();
}

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More OOPS Interview Questions

What is this interview room ? Is it a class or an object.

3 Answers   CybAge, NSN, Wipro,


What do you mean by inline function?

6 Answers  


The expansion of GNU

3 Answers  


What is oops with example?

0 Answers  


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

0 Answers   CAT,


What is difference between class and object with example?

1 Answers  


What is oops in programming?

1 Answers  


Child cObj = new Parent() Wahts the output ?

8 Answers   Patni, TCS,


which is platform independent device used in computers

2 Answers  


What is the difference between procedural programming and oops?

0 Answers  


Program to print 0 to 9 in cross order

3 Answers  


What does I oop mean?

0 Answers  


Categories