26.8.15

Implement function overloading

Write a C++ program to implement function overloading in order to compute power(m,n) where i) m is double and n is int ii) m and n are int.

#include<iostream.h>

#include<conio.h>
#include<math.h>

int power(int a,int b);

double power(int i, double d);

int main()

{

int i1,i2,i3; double d1; clrscr();
cout<<"\nEnter Two Integer Numbers To Calculate Power : "; cin >>i1>>i2;
int p1=power(i1,i2);

cout<<"\nThe Power of "<<i1<<" and "<<i2<<" is : "<<p1; cout<<"\n\nEnter One Integer And One Double To calculate power :"; cin>>i3>>d1;

double p2=power(i3,d1);

cout<<"\nThe Power of "<<i3<<" and "<<d1<<" is : "<<p2; getch();
return(0);

}

int power(int a,int b)

{
return(pow(a,b));
}
double power(int i, double d)
{
return(pow(i,d));
}


********************************OUTPUT**********************************

Enter Two Integer Numbers To Calculate Power : 2  4

The Power of 2 and 4 is : 16

Enter One Integer And One Double To calculate power :2 2.5


The Power of 2 and 2.5 is : 5.656854

27 comments:

  1. You are doing a great job. You inspire me to write for other. Thank you very much. I would like to appreciate your work for good accuracy and got informative knowledge from here. Python Training in Chennai

    ReplyDelete
  2. Excellent information...It was getting more information about your blog. Thanks for sharing, keep updating.
    Best cloud Computing Training Institute in Chennai | Best cloud Computing Training Institute in Velachery

    ReplyDelete
  3. Yesterday I came to visit my sister and we decided to have fun and play online casinos, polazili on a bunch of sites and this one caught my eyeunforgettable gambling statistics Here we quickly figured out what was happening and began to think quickly about the strategy. and we found her now we take money out of here every day

    ReplyDelete
  4. Very nice post here and thanks for latest smartphone applications it .I always like and such a super colors of phone for these post.Excellent and very cool idea and great models and different kinds of the more information's.
    java training in chennai

    java training in tambaram

    aws training in chennai

    aws training in tambaram

    python training in chennai

    python training in tambaram

    selenium training in chennai

    selenium training in tambaram

    ReplyDelete
  5. Useful article which was very helpful. also interesting and contains good information.
    to know about python training course , use the below link.

    Python Training in chennai

    Python Course in chennai

    ReplyDelete
  6. Excellent read, Positive site, where did u come up with the information on this posting? I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work

    Java Training in Chennai

    Java Course in Chennai

    ReplyDelete

Comment Here