For some reason these 2 functions (which I copied from another program of mine that compiles fine) give me this error:
Code:
C:\Program Files\Microsoft Visual Studio\MyProjects\SnSCheckers\main.cpp(138) : error C2601: 'getxcoord' : local function definitions are illegal
C:\Program Files\Microsoft Visual Studio\MyProjects\SnSCheckers\main.cpp(174) : error C2601: 'getycoord' : local function definitions are illegal
which results in
Code:
C:\Program Files\Microsoft Visual Studio\MyProjects\SnSCheckers\main.cpp(187) : fatal error C1004: unexpected end of file found
Here's my prototypes of the 2 functions:
Code:
int getxcoord(void);
int getycoord(void);
Here's where I use them (so far):
Code:
xposition = getxcoord();
yposition = getycoord();
Here's the functions themselves:
Code:
int getxcoord(void)
{
char letter;
int x = 9;
cout << "A - H: ";
while(x == 9)
{
cin >> letter;
letter = toupper(letter);
switch (letter)
{
case 'A': x = 1;
break;
case 'B': x = 2;
break;
case 'C': x = 3;
break;
case 'D': x = 4;
break;
case 'E': x = 5;
break;
case 'F': x = 6;
break;
case 'G': x = 7;
break;
case 'H': x = 8;
break;
default : cout << "Please give a letter from A to H: ";
}
}
return(x);
}
int getycoord(void)
{
int y = 9;
cout << "1 - 8: ";
cin >> y;
while(y < 1 || y > 8)
{
cout << "Please give a number from 1 to 8: ";
cin >> y;
}
return(y);
}
anyone know what's wrong?