编译器给出的错误信息
#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'
参与评论- 相关内容
- 最近更新
- ·下载 Microsoft Visual c++ 6.0 ..
- ·关闭光驱C 什么意思,有没有坏处,..
- ·if(py > py2 - 25 &&..
- ·如何学好C语言?
- ·收藏夹是占有在C盘空间还是E盘
- ·用*号怎样编写一个菱形,用C语言..
- ·用什么软件才能打开.OBJ和.LIB和..
- ·N73中存储卡有太多文件夹,
- ·O2 XDA ATOM 听歌能不能使用蓝牙..
- ·E908数据线如何使用?
添加到百度搜藏