+ 2
Why it's working wrongly?
Why it's working wrongly? https://code.sololearn.com/cDUwRaLnjIG5/?ref=app In structures cin.getline,cin.get is not working. But cin works finely.I replaced char array to string and I used getline but also that's not working why?
2 odpowiedzi
+ 1
for(int i=0;i<n;i++)
{
fflush(stdin); // <= do this or cin.ignore();
cout<<"\nEnter Book Name : ";
cin.getline(b[i].bookname,20);
................
...............
+ 1
cin.ignore() is works correctly.
But fflush(stdin) is not working and that's says error .why? what is fflush and cin.ignore explain please.