Fuction Overload

I'm trying to use a fuction overload to display a int float and a double.
Seems it only wants to display a int.

Any help greatly appreciated



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

using namespace std;

class show
{
public:
int OverloadedFunc(int a)
{
cout << a << endl;
}

float OverloadedFunc(float b)
{
cout << b << endl;
}

double OverloadedFunc(double c)
{
cout << c << endl;
}
};


main(int argc, char *argv[])
{
int OverloadedFunc(int a);
float OverloadedFunc(float b);
double OverloadedFunc(double c);

show a;
a.OverloadedFunc(10);

show b;
b.OverloadedFunc(20.00);

show c;
c.OverloadedFunc(30.0f);


system("PAUSE");

return EXIT_SUCCESS;

}
If not to criticize other aspects.... i'm sure it displays all right, but does not output decimap point and zeros after it.

Try this
1
2
3
4
5
6
7
8
show a;
a.OverloadedFunc(10);

show b;
b.OverloadedFunc(20.05);

show c;
c.OverloadedFunc(30.3f); 


Or use, for example
cout << fixed << setprecision(6) << c << endl;
having included <iomanip> at the top of the file.
Topic archived. No new replies allowed.