Write a program that reads a date in the first format and prints that date in the second format.

Dates are commonly printed in several different formats in business correspondence. Two of the more common formats are
07/21/1955
July 21, 1955

```
#include
using namespace std;

int main()
{
// array to store twelve months of a year
const char *months[ 13 ] = { "", "January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December" };
int m; // integer for month
int d; // day
int y; // year

cout << "Enter a date in the form mm/dd/yy: \n";
cin >> m;
cin.ignore();
cin >> d;
cin.ignore();
cin >> y;
cout << "The date is: " << months[ m ] << ' ' << d << ", "
<< ( ( y < 50 ) ? y + 2000 : y + 1900 ) << endl;

return 0; // indicates successful termination
} // end main
```
Enter a date in the form mm/dd/yy:
7/18/02
The date is: July 18, 2002

Computer Science & Information Technology

You might also like to view...

To avoid an infinite loop, you must ensure that a while statement eventually terminates.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In order to calculate the __________ of an array of values, the array values must first be summed.

a. Average. b. Minimum. c. Maximum. d. Distribution.

Computer Science & Information Technology