我在做2.6章节上机时践时出现以下问题,求解答,感谢!
2.6.2运行光盘源代码问题
#include<iostream.h>
int main(void)
{
bool b;
bool a;
cin>>a;
cin>>b;
cout<<"!a="<<!a<<endl;
cout<<"a&&b : "<<(a&&b)<<endl;
cout<<"a||b :"<<(a||b)<<endl;
return 0;
}
提示如下:
--------------------Configuration: ch2_8 - Win32 Debug--------------------
Compiling...
ch2_8.cpp
e:\c++\c++光盘文件\源文件\第02章\ch2_8\ch2_8.cpp(6) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'bool' (or there is no acceptable conversion)
e:\c++\c++光盘文件\源文件\第02章\ch2_8\ch2_8.cpp(7) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'bool' (or there is no acceptable conversion)
Error executing cl.exe.