C++程序的一个问题
#include <iostream>
int Add (int first, int second)
{
std::cout << "In Add (), received " << first << " and " << second << "\n";
return (first + second);
}
int main()
{
using std::cout;
using std::endl;
cout << "I'm in main()!\n";
int a, b, c;
cout << "Enter two numbers: ";
cin >> a;
cin >> b;
cout << "\nCalling Add()\n";
c=Add(a,b);
cout << "\nBack in main() .\n";
cout << "c was set to " << c;
cout << "\nExiting\n\n";
return 0;
}
编译器是VS C++ 6.0
提示错误:F:\C++\MSDev98\MyProjects\jw\123.cpp(17) : error C2065: 'cin' : undeclared identifier
F:\C++\MSDev98\MyProjects\jw\123.cpp(17) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
F:\C++\MSDev98\MyProjects\jw\123.cpp(18) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
Error executing cl.exe.
不知道该如何解决
问题补充 2009-01-21 19:13
正常运行过,是程序的问题,不知道错在哪.希望强人解决一下
匿名
回答:1
人气:17
解决时间:2009-01-21 19:52