为什么要初始化??
我刚开始学C++,写了一个小程序
提示出来这个
#include<iostream>
using namespace std;
int main()
{
double lang,ma;
ma=lang*220;
cout<<"Enter the lang:";
cin>>lang;
cout<<"It equals to "<<ma<<" ma"<<endl;
return 0;
}
using namespace std;
int main()
{
double lang,ma;
ma=lang*220;
cout<<"Enter the lang:";
cin>>lang;
cout<<"It equals to "<<ma<<" ma"<<endl;
return 0;
}
F:\study\second.cpp(6) : warning C4700: local variable 'lang' used without having been initialized
是没有赋初值吧?可是为什么要赋初值呢?不明白,麻烦解答一下
[此贴子已经被作者于2007-1-27 20:40:26编辑过]