I need to write a program that converts a date entered by the user in numeral format such as 1/25 or 10/3 to the corresponding alphabetical format such as January 25. This program requires that i use Exception-Handling in case the user enters and invalid month or day such as any month above 12 or any day above 31 or however many days that month has. Im having trouble figuring out how separate the date into just the month and day so i can make sure it is in the appropriate range of months or days. Im thinking you need to have the date entered as a string because of the '/' character and then seperate the date in the number for the day and the number for the month and then convert those to integers to make sure the range of months or days. I'm not sure how to go about doin this though. If someone could help me to put this into code or if someone has a better idea of how to go about doing this i would appreciate it if you would help me.

First create an array of month strings char *months[] = { "January", "February", "March", // etc etc } Now all you have to do is index that array with the month-1 string Name = months[m-1]; where m is a numeric value from 1 to 12.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.