excuse me but can someone teach me how to get a string with space
example : this author
i need to get the codes on how to get that
thank you
existinglady 0 Newbie Poster
Recommended Answers
Jump to PostYou must use the
getline
method. Here's an easy example:#include <iostream> #include <string> using namespace std; int main(){ string answer; cout<<"> "; getline(cin, answer); cin.ignore(); cout<<"I have just inserted: "<<answer<<endl; return (0); }
The
getline(cin, answer);
will take whatever you insert, even the …
All 3 Replies
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Albino -6 Junior Poster in Training
Lucaci Andrew 140 Za s|n
TrustyTony commented: Quality post! +12
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.