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

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

A Complete Guide to Programming in C++ part 32. 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. | EXERCISES 289 Exercise 2 In the exercises for chapter 13 an initial version of the Date class containing members for day month and year was defined. Now extend this class to add additional functionality.The methods are shown on the opposite page. The constructors and the method setDate replace the init method used in the former version.The default constructor uses default values for example 1.1.1 to initialize the objects in question.The setDate method without any parameters writes the current date to the object. The constructor and the setDate method with three parameters do not need to perform range checking.This functionality will be added in the next exercise. The methods isEqual and isLess enable comparisons with a date passed to them. The method asString returns a reference to a string containing the date in the format mm-dd-year e.g. 03-19-2006.You will therefore need to convert any numerical values into their corresponding decimal strings. This operation is performed automatically when you use the operator to output a number to the standard output cout. In addition to the cin and cout streams with which you are already familiar so-called string streams with the same functionality also exist. However a string stream does not read keyboard input or output data on screen. Instead the target or source is a buffer in main memory.This allows you to perform formatting and conversion in main memory. Use an application program that calls all the methods defined in the class to test the Date class. Exercise 3 The Date class does not ensure that an object represents a valid date.To avoid this issue add range checking functionality to the class. Range checking is performed by the constructor and the setDate method with three parameters. First write a function called isLeapYear that belongs to the bool type and checks whether the year passed to it is a leap year. Define the function as a global inline function and store it in the header file Date.h. Modify the setDate .

Đã 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.