Help on this project

I have this project due in an hour and needed some help if any of you can. I need it to accept input of any date in the form of MM/DD/YYYY, and convert it to:

Month, date, year. this is my code so far:

#include <iostream>
#include <iomanip>
using namespace std;

enum typeMonth {January = 1, February, March, April, May, June, July,
August, September, October, November, December};

int main(){

int MM, DD, YYYY;
cout << "This will converts your input of the date to a different format" << endl;
cout << "Enter a date: ";
cin >> MM;
cin.ignore(2, '/') << endl;
cin << DD;
cin.ignore(2, '/') << endl;
cin << YYYY << endl;
string xMonth;

cout << "The date you entered is MM/DD/YYYY";



return 0;



}

the part where it says "the date you have entered" is just to see if everything is working right, its not what i need
closed account (N36fSL3A)
What exactly are you trying to see?
i want to be able to type for example 4/3/2013 and have it convert it to April, 3, 2013

i need to use enum and static cast the month variable

im thinking of using a switch statement
Last edited on
closed account (N36fSL3A)
No don't, change the last line to

std::cout << MM << "/" << DD << "/" << YYYY << "\n";

(You don't have to type the std::: prefix)

:)
Last edited on by Fredbill30
#include <iostream>
#include <iomanip>
using namespace std;

enum Month {JANUARY = 1, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY,
AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER};

int main(){

int MM, DD, YYYY;
cout << "This will convert your input of the date to a different format"
<< endl;
cout << "Enter a date: ";
cin >> MM;
cin.ignore(2, '/') << endl;
cin << DD;
cin.ignore(2, '/') << endl;
cin << YYYY << endl;
switch






return 0;



}

new code so far, i only have 45 minutes left, please help
fredbill, thank you for your help, but thats not what i need, i need it to convert the format of MM/DD/YY to Month, day, Year.
#include <iostream>
#include <iomanip>
using namespace std;

enum Month {JANUARY = 1, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY,
AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER};

int main(){

int MM, DD, YYYY;
cout << "This will convert your input of the date to a different format"
<< endl;
cout << "Enter a date: ";
cin >> MM;
cin.ignore(2, '/') << endl;
cin << DD;
cin.ignore(2, '/') << endl;
cin << YYYY << endl;
string xMonth;
switch (Month){
Case 1 = January;
break;

Case 2 = February;
break;

Case 3 = March;
break;

Case 4 = April;
break;

Case 5 = May;
break;

Case 6 = June;
break;

Case 7 = July;
break;

Case 8 = August;
break;

Case 9 = September;
break;

Case 10 = October;
break;

Case 11 = November;
break;

Case 12 = December;
break;

default:
cout << "Wrong, there are only 12 months";
}

cout << << xMonth << "," << DD << " " << YYYY << "\n";




return 0;



}


code update, how do i put the switch value into xMonth? please only 30minutes left
closed account (N36fSL3A)
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
38
39
40
41
42
43
44
45
46
47
string Month;

switch(MM)
{
	case 1:
		Month = "January";
	break;
	case 2:
		Month = "Febuary";
	break;
	case 3:
		Month = "March";
	break;
	case 4:
		Month = "April";
	break;
	case 5:
		Month = "May";
	break;
	case 6:
		Month = "June";
	break;
	case 7:
		Month = "July";
	break;
	case 8:
		Month = "August";
	break;
	case 9:
		Month = "Spetember";
		break;
	case 10:
		Month = "October";
	break;
	
	case 11:
		Month = "November";
	break;
	
	case 12:
		Month = "December";
	break;
}

Then output it like:

[code]cout << Month << DD << YYYY;
closed account (N36fSL3A)
Sorry if you didn't get your project in on time, but is this good enough?
Topic archived. No new replies allowed.