Getline problems | Sololearn: Learn to code for FREE!


Getline problems

Hi, i am a stud in software engineering course and i are having with getline use in C++. I wrote a variables 'name' and cin>>John Labu and i use getline(cin,name) to get the entire line.. but frustratingly... i only get Labu in cout<<name.. and ive been trying to find the problem.... hope someone can help me with this😥

12/11/2018 2:35:53 PM

Abdul Malik

4 Answers

New Answer


Can you show the code.. It should be something like string name; getline(cin, name); cin >> name; //Your name here cout<<name;


Abdul Malik Make it like how I've stated.. you should ask for input after getline(cin, name) That should work


well it was like cout<<"enter name"; getline(cin,name) cout<<name;


okay thank you😊