cin.getline function does'nt gets executed for the second time

akshatmaltare05's Avatar, Join Date: Aug 2011
Newbie Member
using namespace std;
int main()
        int numnonterm;
        char terminal[10];
        char nonterminal[10][10];
        char tempterminal[10];
        cout<<"enter the terminals used";
        cin.getline (terminal,10);
        cout<<"enter the no of non terminal elements";
        cout<<"enter the nonterminals";
        if(int i=0)
the program exits without waiting for the user to enter the tempterm string .
have tried it several times but is not working

Last edited by shabbir; 10Aug2011 at 21:35.. Reason: Code blocks
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Use fflush before the cin and that should work.