函数重载——求问这个程序哪里出错了?
include <iostream.h>int abs (int x)
{
return x>0 ?x:-x;
}
double abs(double x)
{
return x>0 ?x:-x;
}
void main ()
{
cout <<"-10的绝对值是:"<<abs(-10) <<endl;
cout << "-123.45的绝对值是:"<< abs(-123.45) <<endl;
}
[此贴子已经被作者于2016-10-24 22:28编辑过]