cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
How to input a sentence (string with man
How to input a sentence (string with many words)
Nov 11, 2017 at 5:33pm UTC
Demrottens
(13)
I have tried cin.get(t,1999);, I tried std::getline(cin,1999), I cant seem to find any solutions, in throws this error:
Error: unable to find coincident function for 'getline(std::istream&, int);'
Thats a translation because my compiler is in spanish
Any ways to do it? I may have done something wrong but I cand find it, heres teh code:
char t[2000]; std::getline(cin, 1999);
Nov 11, 2017 at 5:40pm UTC
jlb
(4973)
The getline() function requires two arguments, the first is the stream (cin in this case) and the second argument is a std::string. You seem to be trying to use a const integer instead of the string variable.
Nov 11, 2017 at 6:11pm UTC
Demrottens
(13)
So I should use it like
1
2
3
string t; std::getline(cin, t);
this?
Nov 11, 2017 at 6:55pm UTC
goldenchicken
(160)
Almost, you need std::getline(
std::
cin, t);
Topic archived. No new replies allowed.