30 - Function Overloading

#include 
using namespace std;
void printNumber(int x)
{
    cout<<"i am printing an integer " << x << endl;
}
void printNumber(float x)
{
    cout<<"now i am printing a float " << x << endl;
}
int main()
{
    int a = 54;
    float b = 32.4896;
    printNumber(a);
    printNumber(b);
}

你可能感兴趣的:(30 - Function Overloading)