编程求两个或三个操作数之和
#include "iostream.h"
int sum(int x,int y);
int sun(int x,int y,int z);
double sum(double x,double y);
double sum(double x,double y,double z);
void main()
{
cout<<sum(2,5)<<end1;
cout<<sum(2,5,7)<<end1;
cout<<sun(1.2,5.0,7.5)<<end1;
int sum(int x,int y)
{
return x+y;
}
int sum(int x,int y,int z)
{
return x+y+z;
}
double sum(double x,double y)
{
return x+y;
}
double sum(double x,double y,double z)
{
return x+y+z;
}
编译运行之后提示一下错误和警告
error C2601: 'sum' : local function definitions are illegal
warning C4244: 'argument' : conversion from 'const double' to 'int', possible loss of data
请前辈帮小第解决一下这个问题...谢谢..!