为什么出现两个warning(s)!
#include "stdafx.h"
#include<iostream.h>
class CSum
{
public:
CSum(int a,int b)
{
sum=a+b;
}
int getsum()
{
return sum;
}
private:
int t,sum;
};
int main(int argc, char* argv[])
{
int x,y;
CSum one(x,y);
cout<<"输入两个数:";
cin>>x>>y;
cout<<one.getsum()<<endl;
return 0;
}
--------------------Configuration: chengxu002 - Win32 Debug--------------------
Compiling...
chengxu002.cpp
F:\VC++\VC++程序\MSDev98\MyProjects\chengxu002\chengxu002.cpp(23) : warning C4700: local variable 'y' used without having been initialized
F:\VC++\VC++程序\MSDev98\MyProjects\chengxu002\chengxu002.cpp(23) : warning C4700: local variable 'x' used without having been initialized
Linking...
chengxu002.exe - 0 error(s), 2 warning(s)