#include <iostream>
using namespace std;
void getMonthName(int monthNum);
void main()
{
int month, i=0;
cout << "Enter a month " << endl;
cin >> month;
while (!cin.good() && i <3) {
cout << " Bad input.\n";
cin.clear();
cin.ignore(80,'\n');
cout << " Try again: ";
cin >> month;
i++;
}
while (!cin.good()) {
cout << " try enter a number.\n";
cin.clear();
cin.ignore(80,'\n');
cout << " 1 for Jan: ";
cin >> month;
}
cout <<getMonthName(month)<<endl; ****** keep getting a error for this line. why?
}
void getMonthName (int monthVal) // month name
{
int num = monthVal;
switch (num)
{
case 1: cout<<"January";
break;
case 2: cout<<"February";
break;
case 3: cout<<"March";
break;
case 4: cout<<"April";
break;
case 5: cout<<"May";
break;
case 6: cout<<"June";
break;
case 7: cout<<"July";
break;
case 8: cout<<"August";
break;
case 9: cout<<"September";
break;
case 10: cout<<"October";
break;
case 11: cout<<"November";
break;
case 12: cout<<"December";
break;
}}
help with this error message. i dont know how to fix it. thanks