int main()
{
int state = -1;
int scanning = -1;
cout << "Welcome to the lexcial scanner.\nPlease enter a char" << endl;
char textfile ;
textfile = getchar();
if(textfile == 'A' || textfile == 'B')
{
state = 1;
textfile = getchar();
cout << "does it work?" <<endl;
}
return 0;
}
this program gets to the if statement but doesnt carry out the 2nd getchar function. Could anyone provide an explaintation?
Thanks :)