Why is the function declared along with "int x" and "float x"? What exactly is its purpose? 
What if the code was like this :


#include <iostream>
using namespace std;

void printNumber(int a)
{
    cout<<"I am printing an integer " <<a<<endl;
}

void printNumber(float b)
{
    cout<<"I am printing a float value"<<b<<endl;
}

int main()
{
    int a ;
    float b;

    cout<<"Enter the value of a";
    cin>>a;

    cout<<"Enter the value of b";
    cin>>b;

    printNumber(a);
    printNumber(b);

}