home *** CD-ROM | disk | FTP | other *** search
- // C++ program that illustrates constants
-
- #include <iostream.h>
-
- #define SEC_IN_MIN 60
- #define MIN_IN_HOUR 60
-
- main()
- {
- long hours, minutes, seconds;
- long totalSec;
-
- cout << "Enter hours: ";
- cin >> hours;
- cout << "Enter minutes: ";
- cin >> minutes;
- cout << "Enter seconds: ";
- cin >> seconds;
-
- totalSec = ((hours * MIN_IN_HOUR + minutes) *
- SEC_IN_MIN) + seconds;
-
- cout <<"\n\n" << totalSec << " seconds since midnight";
- return 0;
- }
-