Answer the question
In order to leave comments, you need to log in
How to easily do string I/O in Visual C++?
I write in C++ and when I'm working with the string type, I'm great at using cin>>s, cout< < s, and so on. But all this works on all compilers except VISUAL C++. There he does not understand cin>>s
Of course, you can write the input to char* and so on ... but isn't there a normal way to count a line in a visual, without dancing with tambourines ???
Answer the question
In order to leave comments, you need to log in
#include <iostream>
#include <string>
int main() {
std::string s1, s2;
std::getline(std::cin, s1);
std::cin >> s2;
}
The fact is that in VC++ the >> and << operators for strings are defined not with the string class (file ) , and not even with the iostream class (file ), but in a separate file
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question