#include <iostream>
using namespace std;
int main()
{
float add(float x,float y);
float a,b,c;
cout<<"Please enter a,b:"<<endl;
cin >>a>>b;
c=add(a,b);
cout<<"sum="<<c<<endl;
return 0;
}
float add(float x, float y)
{
float z;
z=x+y;
return z
}
在VS2010下编译,为什么add函数在主函数之后的时候不会输出“sum=”,而如果add函数在主函数之前就会输出“sum=”?
本人初学C++,求指教....