I\'m writing a C program in class that requires us to input dates as integers in a structure defined as:
typedef struct date{ int month; int day;
On a system with POSIX strptime() or a similar function, if you first read the string representation into str, you can then use:
strptime()
str
struct tm tm; strptime(str, "%m/%d/%Y", &tm);
It translates to your date as follows:
date
date.year = tm.tm_year; date.month = tm.tm_mon; date.day = tm.tm_mday;