guyndenton
09-21-2002, 01:24 AM
Sorry if this has been been asked, but I already did some research and couldn't find what I was looking for....
A little about what I'm needing to do.
Create a structure of type date that contains three members: the month, the day of the month, and the year, all of type int. (Or use day-month-year order if you prefer.) Have the user enter a date in the format 12/31/2001, store it in a variable of type struct date, then retrieve the values from the variable and print them out in the same format.
Here's my code thus far:
struct date
{
int DateMonth, DateDay, DateYear;
};
void main ()
{
char DateIn;
cerr << "Please enter a date in the format 12/01/2001: ";
cin >> DateIn;
cerr << endl;
}
I need to extract the integers from the char string into the repective fields in the struct employee. Once I extract the needed data, I just need to spit out what date in a similar format.
Thanks.
A little about what I'm needing to do.
Create a structure of type date that contains three members: the month, the day of the month, and the year, all of type int. (Or use day-month-year order if you prefer.) Have the user enter a date in the format 12/31/2001, store it in a variable of type struct date, then retrieve the values from the variable and print them out in the same format.
Here's my code thus far:
struct date
{
int DateMonth, DateDay, DateYear;
};
void main ()
{
char DateIn;
cerr << "Please enter a date in the format 12/01/2001: ";
cin >> DateIn;
cerr << endl;
}
I need to extract the integers from the char string into the repective fields in the struct employee. Once I extract the needed data, I just need to spit out what date in a similar format.
Thanks.