How to input a sentence (string with many words)

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);

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.

So I should use it like

1
2
3
string t;

std::getline(cin, t);


this?
Almost, you need std::getline(std::cin, t);
Topic archived. No new replies allowed.