程序改错解决方案
程序改错
提示error C2065: “a”: 未声明的标识符..请问原因??以及如何改错???
------解决方案--------------------
a未定义,如果作为字符应该用 'a'
------解决方案--------------------
- C/C++ code
#include <iostream> using namespace std; class boolit { public: void setword(char w) { word=w; } void print() { cout<<word; } private: char word; }; int main() { boolit b1; b1.setword(a); b1.print(); system("pause"); return 0; }
提示error C2065: “a”: 未声明的标识符..请问原因??以及如何改错???
------解决方案--------------------
a未定义,如果作为字符应该用 'a'
------解决方案--------------------
- C/C++ code
#include <iostream> using namespace std; class boolit { public: void setword(char w) { word=w; } void print() { cout<<word; } private: char word; }; int main() { boolit b1; b1.setword('a'); b1.print(); system("pause"); return 0; }