Question: 6 Write a class named Date which has three private data: day, month, year; and two friend functions: operator < < and operator>>. In operator>>,

6 Write a class named Date which has three private data: day, month, year; and two friend functions: operator<< and operator>>. In operator>>, prompt user to input a date with format dd/mm/yyyy and then use strtok to separate the numbers and assign them to the data members. In operator<< , you need to output the date with format: Jan. 5, 2016 (you may define a const char monthName[12][4] to store the short name of months). Then write a main program to create an object and call cin and cout. You can assume the user will input correct format. Sample output: Enter date in format dd/mm/yyyy: 4/12/2015 The date is: Dec. 4, 2015

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!