C++变量声明位置问题请教各位大神
#include <iostream>
double tian(double);
//double aa; 变量 aa 放在这里声明正常
int main()
{
using namespace std;
double cc;
double aa; 变量 aa 放在这里声明异常提示“Run-Time Check Failure #3 - The variable 'aa' is being used without being initialized.”
cc = tian(aa);
cout << "你输入的是: "
<< cc
<< endl;
cin.get();
return 0;
}
double tian(double a)
{
using namespace std;
cout << "请输入一个数字: ";
cin >> a;
cin.get();
return a;
}
各位大神好,我是编程小白。请教大家一个问题,上面的代码中 double变量 aa 放在函数main中不正常,“Run-Time Check Failure #3 - The variable 'aa' is being used without being initialized.”;放在头文件的位置声明正常,这是什么原因呢?