void main()
{
float x,y;
cin>> x;
if(x>=0)
y=2*x+1;
else
y=-x/2;
cout<< y<< endl;
}
运行时提示错误是:
--------------------Configuration: ling - Win32 Debug--------------------
Compiling...
ling.c
C:\C程序算法\ling.c(4) : error C2065: 'cin' : undeclared identifier
C:\C程序算法\ling.c(4) : error C2296: '>>' : illegal, left operand has type 'float '
C:\C程序算法\ling.c(4) : error C2297: '>>' : illegal, right operand has type 'float '
C:\C程序算法\ling.c(9) : error C2065: 'cout' : undeclared identifier
C:\C程序算法\ling.c(9) : error C2296: '<<' : illegal, left operand has type 'float '
C:\C程序算法\ling.c(9) : error C2297: '<<' : illegal, right operand has type 'float '
C:\C程序算法\ling.c(9) : error C2065: 'endl' : undeclared identifier
执行 cl.exe 时出错.
ling.obj - 1 error(s), 0 warning(s)
我是刚学C++的,但一开始编译就遇到这样的情况,请各位指点下,谢谢!