Question: Task 4: use c++ to Start with the date structure in Task 3 and transform it into a date class. Its member data should consist

Task 4: use c++ to Start with the date structure in Task 3 and transform it into a date class. Its member data should consist of three ints: month, day, and year. It should also have two member functions: getdate(), which allows the user to enter a date in 12/31/02 format, and showdate(), which displays the date.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

so here is my output code from the Task 3 please help me to asnwer this question, thank you

#include #include using namespace std;

// defining struct date struct date { int month; // for month int day; // for day int year; // for year };

int main() { // declaring d as date struct date d; // char input for date char input[20]; // printing message cout<<"Enter a date in the format(month/day/year) :"; // accepting input from the user cin>>input; // get the month from the char array char *p = strtok(input, "/"); // convert it to int and store it in month d.month = atoi(p); // get the day from the char array p = strtok(0, "/"); // convert it to day and store it in day d.day = atoi(p); // get the year from the char array p = strtok(0, "/"); // convert to int and store in year d.year = atoi(p); // printing the date cout<<"Entered date is : "; cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!