我编了一个程序,不知错在那??还请高手点拨 #include<iostream> #include<string>
using namespace std;
void main() { char p,q; int c0,c1; while(cin.get(p)){ q=cin.get(p); if(q=='\"')c0=1; else c0=0; if(c0==0){ if(q=='/'){ if(cin.get(p)=='/') c1=2;} if(q=='*')if(cin.get(p)=='/') c1=3; } c1=1; switch(c1) {case'1':cout.put(p);break; case'2':while(p!='\n')cout.put('\0');break; case'3':do{cout.put('\0');}while(q!='/');break; default:; }
}
} 调试结果为: -------------------Configuration: no3 - Win32 Debug-------------------- Compiling... no3.cpp F:\no3\no3.cpp(13) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_istream<char,struct std::char_traits<char> >' (or there is no acceptable conversion) F:\no3\no3.cpp(18) : error C2679: binary '==' : no operator defined which takes a right-hand operand of type 'const char' (or there is no acceptable conversion) F:\no3\no3.cpp(20) : error C2679: binary '==' : no operator defined which takes a right-hand operand of type 'const char' (or there is no acceptable conversion) 执行 cl.exe 时出错.
no3.exe - 1 error(s), 0 warning(s)