Hello,
I got the code working OK, then when I monved all my FunctionCall to main I got error, I don't know why it didn't work, but it work fine when I put it in the FunctionCall file. Can someone help me see what I did wrong???
CODE
#include <iostream>
#include <string>
#include "GreenFunction.h"
using namespace std;
char* get_num_month(int month);
int main()
{
int mm = 0;
char *month;
char ch = 'y';
static char arr[][10] = {"January","February","March","April","May","June","July","August","September","October","November","December"};
while(ch == 'y' || ch == 'Y')
{
cout << "Enter month number I will display it in string: ";
cin >> mm;
if( mm < 1 || mm > 12 )// Validate to see if input for month is valid
{
cout << "INVALID month: Please try again." << endl;
cin.get();
system("pause");
return 0;
}
else
month = get_num_month(mm);
//month++
cout << "The month you entered: " << mm << " is :" << month << endl;
cout << "Do you wish to enter another month number? <y/n> ";
cin >> ch;
cin.get();
}
cout << "Good bye and have a wonderfull day!" << endl;
cin.get();
return arr[month-1]; <<<<<< this were the error complained
//return 0;
}
This is the error:error C2107: illegal index, indirection not allowed
This post has been edited by KMH: 10 Apr, 2008 - 06:09 PM