1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

Discussion in 'C++' started by akshatmaltare05, Aug 10, 2011.

  1. akshatmaltare05

    akshatmaltare05 New 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 a moderator: Aug 10, 2011
  2. shabbir

    shabbir Administrator Staff Member

    Use fflush before the cin and that should work.

Share This Page