I don't know if I read the book right but my array is not working on my months .My instructions is
this assignment uses an array of strings:
write a C program that asks the user for the month, day, and year
read in the month, day and year (as ints)
the function header should be void PrintMonth(int month)
the function accepts the month as a parameter and prints out the proper month name
the function does not have to verify a valid date
best approch is to declare an array of 12 strings and initialize the elements of the array with the proper month name
/****************************
* prototypes //declared function so main can find
*****************************/
void printMonth(int m);
/**************************************
*
***************************************/
char month[13] =
{"January","Febuary","March", "April", "May", "June", "July", "August",
"September", "October", "November", "December"};
int main()
{
int month;
int day;
int year;
cout << "enter the month: ";
cin >> month;
cout << "enter the day: ";
cin >> day;
cout << "enter the \year: ";
cin >> year;
cin.ignore();
cout << month << " " << day << " " << year << "\n";
cin.get();
system("pause");
}
void printMonth(int m)
{
cout << month[m] << "\n";
}