i need the user to input a todolist type thing it uses strings to save the items.
what i need to know is how to have the user input a string with the getline function any help would be much appreciated
fopah 0
Newbie Poster
Recommended Answers
Jump to Post#include <iostream> #include <string> int main() { std::string input; std::cout << "Enter a string: "; if ( getline(std::cin, input) ) { std::cout << "You entered " << input << std::endl; } return 0; }
All 3 Replies
Dave Sinkula 2,398
long time no c Team Colleague
arshaad -3
Newbie Poster
Dave Sinkula
commented:
Thanks! I've waited four and a half years for this advice. :icon_rolleyes: -2
arshaad -3
Newbie Poster
William Hemsworth
commented:
go away. -1
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.