TAILIEUCHUNG - A Complete Guide to Programming in C++ part 59

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 --------------------------------------------------------- Defines the CityCar class --------------------------------------------------------- ifndef _CITY_H_ define _CITY_H_ include 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 --------------------------------------------------------- Methods of class CityCar --------------------------------------------------------- include 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 No previous input for int i 0 i cnt i vp i - display if i 1 4 0 ----------------------------------------------------- Test the CityCar class ----------------------------------------------------- include 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 6 54321 Ford 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 tp sr n prod break case T case t getTruck a t n prod a t n prod break case D case d 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 .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.