Đang chuẩn bị liên kết để tải về tài liệu:
A Complete Guide to Programming in C++ part 59

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

A Complete Guide to Programming in C++ part 59. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | SOLUTIONS 559 --------------------------------------------------------- city.h Defines the CityCar class --------------------------------------------------------- ifndef _CITY_H_ define _CITY_H_ include car.h class CityCar private Car vp 100 int cnt public CityCar cnt 0 CityCar bool insert const string tp bool sr long n const string prod bool insert int a double t long n const string prod void display const endif _CITY_H --------------------------------------------------------- city.cpp Methods of class CityCar --------------------------------------------------------- include city.h CityCar CityCar for int i 0 i cnt i delete vp i Insert a passenger car bool CityCar insert const string tp bool sr long n const string prod if cnt 100 vp cnt new PassCar tp sr n prod return true else return false 560 CHAPTER 25 POLYMORPHISM Insert a truck bool CityCar insert int a double t long n const string prod if cnt 100 vp cnt new Truck a t n prod return true else return false void CityCar display const cin.sync cin.clear No previous input for int i 0 i cnt i vp i - display if i 1 4 0 cin.get ----------------------------------------------------- city_t.cpp Test the CityCar class ----------------------------------------------------- include city.h char menu void void getPassCar string bool long string void getTruck int double long string int main CityCar carExpress string tp prod bool sr int a long n double t Two cars are already present carExpress.insert 6 9.5 54321 Ford carExpress.insert A-class true 54320 Mercedes char choice do choice menu switch choice case Q case q cout Bye Bye endl break SOLUTIONS 561 case P case p getPassCar tp sr n prod carExpress.insert tp sr n prod break case T case t getTruck a t n prod carExpress.insert a t n prod break case D case d carExpress.display cin.get break default cout a Beep break while choice Q choice q return 0 char menu Input a command. cout n Car Rental Management n n char c cout n n n n n nYour P Add a passenger car T Add a truck D .