A
A
a-lexus91_yandex2016-09-24 19:10:44
Programming
a-lexus91_yandex, 2016-09-24 19:10:44

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

2 answer(s)
N
none7, 2016-09-24
@none7

#include <iostream>
#include <string>

int main() {
    std::string s1, s2;
    std::getline(std::cin, s1);
    std::cin >> s2;
}

D
Daniil Demidko, 2016-11-27
@Daniro_San

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 question

Ask a Question

731 491 924 answers to any question