C++ Programming Blog

 
 
 

Image

 #include<iostream.h>
 #include<conio.h>

 int square(int);
 float square(float);

 main()
    {
       clrscr();

       int value_1;

       float value_2;

       cout<<\"\\n Enter the value_1 = \";
       cin>>value_1;

       cout<<\"\\n Enter the value_2 = \";
       cin>>value_2;

       cout<<\"\\n The square of value_1 = \"<<square(value_1)<<endl;
       cout<<\"\\n The square of value_2 = \"<<square(value_2)<<endl;

       getch();
       return 0;
    }


 //----------------------------  square(int)  ----------------------------//


 int square(int value)
    {
       return value*value;
    }


 //---------------------------  square(float)  ---------------------------//


 float square(float value)
    {
       return value*value;
    }

 
 
Didn't find what you were looking for? Find more on Program to illustrate the use of function overloading