When I pass 3.0 & 4.0 from calc in main, I expect to see double values inside the function, which are not. The values of 4 and 3 are also returned. Why are the parameters "losing" the decimal place passed to it?
#include<iostream>
int calc(int a, int b)
{
return a+b;
}
double calc(double a, double b)
{
std::cout<<a<<" "<<b<<std::endl;
return a+b;
}
double calc(int pi)
{
return pi * pi;
}
int main()
{
constdouble pi = 3.14159;
std::cout<<calc(3,4)<<std::endl;
std::cout<<calc(3.0, 4.0)<<std::endl;
std::cout<<calc(pi)<<std::endl;
return 0;
}