Hey Guys i seem to be having an issue with the follwoing code when i complie in VC++ 2010. It compiles fine in both minGW and VC++ 2008. The code is as follows...

The Program accepts three inputs whereby it outputs them in alphabetical order, very simple.

#include <iostream>
#include <vector>
#include <algorithm>

using std::cout; using std::cin; using std::endl;

using std::string; using std::vector;

int main()
 string Student_Name;

        for (int A=0; A<=3; A++)
            cout<<"Enter a students name: ";
               for (int B=0; B<=3; B++)
                cout << STUDENTS_NAME[B];
                cout << endl;
return 0;

I think the problematic lines are as follows as intellisense tells me "Error: no operator ">>"matches these operands"


When the code is compiled the error is as follows:
error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)

Any help much appreciated, :)

Clearly Visual C++ 2010 is smarter in terms of implicit standard headers. You failed to include <string>, and the compiler rightly complains. The others don't complain because <string> is probably included inside one of the other three standard headers you've included, so the bug goes unnoticed.

Edited 6 Years Ago by Narue: n/a

This question has already been answered. Start a new discussion instead.