Skip to Content
Navigating C++ and Object-Oriented Design
book

Navigating C++ and Object-Oriented Design

by Paul Anderson, Gail Anderson
October 1997
Intermediate to advanced
800 pages
20h 48m
English
Pearson
Content preview from Navigating C++ and Object-Oriented Design

4.15. Exercises

1:Examine the following C++ program.
 // dates.C - Date class #include <iostream.h> #include "Date.h" int main() { try { Date d1(7,31,1996); // set date d1.print(); // display date d1.tomorrow(); // display next day d1.yesterday(); // display previous day d1.set(10,31,1900); // change date d1.print(); // display date Date d2; // set to today's date d2.print(); // display date Date d3(9,1,1900); // set date d3.yesterday(); // display previous day Date d4(7,3,1996); // set date cout << d4.month() << '/'; // display month cout << d4.day() << '/'; // display day cout << d4.year() << endl; // display year d4.month(12); // set month d4.day(31); // set day d4.year(1999); // set day Date d5 = d4; // create new date d5.print(); // display ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Exploring C++20: The Programmer's Introduction to C++

Exploring C++20: The Programmer's Introduction to C++

Ray Lischner

Publisher Resources

ISBN: 0135327482Purchase book