A题
int main()
{ float a,b;
cout<<add(3.4,4.7);
}
int add(float a, float b)
{float c=a+b;
}//error: 'add' was not declared in this scope
B题
int main()
{ float a,b;
cout<<add(3.4,4.7);
}
float add(float a, float b)
{float c=a+b;
}//error: 'add' was not declared in this scope
C题
float add(float a, float b);
int main()
{ float a,b;
cout<<add(3.4,4.7);
}
float add(float a, float b)
{float c=a+b;
}//8.1
D题
float add(float a, float b)
{float c=a+b;
return c;
}
int main()
{ float a=3.4,b=4.7;
cout<<add(a,b);
}//结果8.1