Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Hero, please design a c++ program to calculate the sum of squares of two numbers with overloaded functions. Realize integer and floating-point calculation respectively.
Hero, please design a c++ program to calculate the sum of squares of two numbers with overloaded functions. Realize integer and floating-point calculation respectively.
# include & ltiostream & gt

Use namespace std

int square(int x,int y);

Floating square (floating x, floating y);

Double square (double x, double y);

int main()

{

//test

cout & lt& ltsquare(2,4)& lt; & ltendl

cout & lt& ltsquare(2. 1f,4.5f)& lt; & ltendl// Note that the value in this place should be followed by f.

cout & lt& ltsquare(2. 1,4.5)& lt; & ltendl

Returns 0;

}

int square(int x,int y)

{

cout & lt& lt" int:"; //Proof

Returns x * x+y * y;;

}

Floating square (floating x, floating y)

{

Cout & lt& lt "floating"; //Proof

Returns x * x+y * y;;

}

Double square (double x, double y)

{

cout & lt& lt" double:"; //Proof

Returns x * x+y * y;;

}