im trying to understand why im forced to use 'cin.ignore();' in my example code
and why when i run it without 'cin.ignore();' it jumps a bit to far in my code .
its kinda anoying to not know., pls explain to me
sorry for my bad englishCode:#include <iostream> #include <cstring> using namespace std; struct database { char name[256]; char lastnume[256]; char cellnr[256]; char adress[256]; }; int main() { struct database data; cout<<" Please enter your data about you !\n"; cout<<" Please enter your name:"; cin>> data.name; cin.ignore(); cout<<" Please enter your lastname:"; cin.getline ( data.lastnume, 256, '\n'); cout<<" Please enter your Cell nr.:"; cin.getline ( data.cellnr, 256, '\n'); cout<<" Please enter your adress:"; cin.getline ( data.adress, 256, '\n'); cout<<"\n Name: \t"<< data.name; cout<<"\n Lastname: \t"<< data.lastnume; cout<<"\n Cell nr.: \t"<< data.cellnr; cout<<"\n Adress: \t"<< data.adress; cin.get(); }



LinkBack URL
About LinkBacks
, pls explain to me 




