您的位置 电脑知识爱好者 >> 编程知识 >> 编译器给出的错误信息

编译器给出的错误信息

电脑知识爱好者互联网本站整理2007-9-17 1:12:27
知识重点:#includeiostream using namespace std; #includeconio.h class tollbooth { public: tollbooth(): number(0),fee(0.0) {} void payingCar(); void nopayCar(); void display();..

#include<iostream> using namespace std; #include<conio.h> class tollbooth { public: tollbooth(): number(0),fee(0.0) {} void payingCar(); void nopayCar(); void display(); private: unsigned int number; double fee; }; /////////////////////////////////// void tollbooth::payingCar() { number++; fee += 0.5; } void tollbooth::nopayCar() { number++; } void tollbooth::display() { cout<<"\nThe total number of cars is"<<number; cout<<"\nThe total fee is"<<fee; } /////////////////////////////////// int main() { tollbooth to; char key; key=getch(); do{ if(key=='z') to.payingCar(); if(key=='x') to.nopayCar(); } while(key!='c') to.display(); return 0; } while(key!='c')后面少了分号,应该是while(key!='c');

看一下编译器给出的错误信息,否则所有的程序基本上你都会拿来问的,错误信息明明白白的写着:

E:\work\tsttt\eee.cpp(49) : error C2146: syntax error : missing ';' before identifier 'to'

参与评论
相关内容
关于我们 | 隐私政策 | 站点地图 | 站长博客|京ICP备07025396号
添加到百度搜藏 添加到百度搜藏 电脑知识爱好者Copyright ?2006-2008版权所有 我要啦免费统计