Background info: I'm using Parallels Desktop 10 to run Windows 8.1 as a VM directly alongside of OS X 10.10. So on OS X, I primarily use Eclipse, and for Windows, I use Visual Studio.
I'm having a problem with std::cin working in Visual Studio. I'm not exactly sure what the problem is, it's just giving an error on the ">>" operator.
Example (underlined text is the error underlined in the IDE):
Eclipse:
1 2 3 4 5 6 7 8
|
#include <iostream>
using namespace std;
int main(void) {
string text;
cout << "Enter some text: ";
cin >> text;
cout << "Hello, " << text << endl;
}
|
Visual Studio:
1 2 3 4 5 6 7 8
|
#include <iostream>
using namespace std;
int main(void) {
string text;
cout << "Enter some text: ";
cin >> text;
cout << "Hello, " << text << endl;
}
|
And here's the error that Visual Studio is giving me:
"Error: no operator ">>" matches these operands
operand types are: std::istream >> std::string"
P.S. I'm pretty new to C++ programming, so forgive me if the answer is literally right there in front of me. But I think I just realized I should replace std::cin in my code with std::istream, according to the error that I'm just now understanding, lol.
EDIT: I just tried replacing std::cin with std::istream and it didn't work.