I am trying to use this command, 'cin.getline', in a loop, but it does not work properly; in details, it works the first time the loop is executed; the subsequent times, it is just ignored; now, in all the books I am using ther's no mention of this strange behavior; nor there is anything in the tutorial that comes with the Visual C++ that I have. Could you please help me overcome this problem, and explain to me why is behaving like that, done the fact that in my books, and in the documentation ovf Visual C++ it says that this command does NOT carry any linefeed?
thanks so much for the attention.
I include an example of the code where I have met this problem; but is not the only one time...
int a = 0;
float cont = 0.0f;
for(a; a < 10; a++)
cout << "\nenter a word: ";
cin.getline(arr[a],30, '\n'); // quÃ¬ non va; e non
// Ã¨ la prima volta!!!
for(int i = 0; i <30; i++)
cout << arr[a][i];
if(arr[a][i] == '\0')
cout << "do you want to enter another one?";
cout << "\n(Enter 0 to end, 1 to continue): ";
cin >> ind ;
if(ind == '0')
cout << " " << endl;
cont = sizeof(arr)/sizeof(arr);
cout << cont;
cout << endl;