1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <iostream>
using namespace std;
//Declare enumeration type
enum monthType {January = 1, Februaury = 2, March = 3, April = 4, MAy = 5, June = 6,
July = 7, August = 8, September = 9, October = 10, November = 11, December = 12};
int main()
{
//Declare variables
monthType monthTypeVariable;
int intVariable, num2, num3;
char ch1, ch2;
//Retrieve date
cout << "enter date in mm/dd/yyyy: ";
cin >> intVariable >> ch1 >> num2 >> ch2 >> num3;
cout << endl;
//convert month number to month word
monthTypeVariable=static_cast<monthType>(intVariable);
//output date
cout<< "date is " << monthTypeVariable <<ch1 << num2 << ch2 << num3;
cout << endl;
return 0;
}
|