Ok here's the problem and I'm despaired about it. I get a 9*9 table using
for (int i=0 ; i < 9 ; i++)
for (int j=0 ; j < 9 ; j++)
cin >> table [i][j];
I want to make some changes to this table . so I get a command using:
getline (cin , command);
so user would type a command and after parsing it I will make the changes to the table. (it has to be getline() because command is an string and contains spaces)
I have an in.txt containing the table . I give this file to my code using :
g++ main.cpp
./a.out < in.txt .
(these two commands are written in terminal)
after that I want to give my command using keyboard . but the getline() doesn't get anything from keyboard . I tried using
cin.ignore() , cin.clear() , cin.sync () , even cin.get()
but it always passes the getline() .
Any suggestions would be appreciated . thanks in advance.