<<< Programmatic control | Index | Procedural approach >>> |
Conversion functions such as serial Julian date can help:
#include <iostream> int serial_julian_date( int Month, int Day, int Year ); int serial_2_month( int nDate ); int serial_2_day( int nDate ); int serial_2_year( int nDate ); int main() { int month = 3; int day = 8; int year = 2010; // Compute serial date int serial_date = serial_julian_date( month, day, year ); // Modify serial date: serial_date = serial_date + 100; // add 100 days month = serial_2_month( serial_date ); day = serial_2_day( serial_date ); year = serial_2_year( serial_date ); // Display new date in human-friendly format: std::cout << month << '/' << day << '/' << year << '\n'; return 0; }
<<< Programmatic control | Index | Procedural approach >>> |