Friday, July 31, 2009

Help with C++! i don't what this error means and neither how to fix it! help!!!!!!!!!?

Error1error C2679: binary '%26gt;%26gt;' : no operator found which takes a right-hand operand of type 'std::basic_istream%26lt;_Elem,_Traits%26gt;' (or there is no acceptable conversion)


THIS IS MY CODE:


#include %26lt;iostream%26gt;


#include %26lt;string%26gt;


#include %26lt;iomanip%26gt;





using namespace std;





int main()


{


//declare variables


string name = "";





//get a name from user


cout %26lt;%26lt; "Enter a 5 charater name: " %26lt;%26lt; endl;


cin %26gt;%26gt; getline(cin, name);





//determines if the name is 5 characters


while (name.length() != 5)


{


cout %26lt;%26lt; "You five character name is: ";


getline(cin, name);


}//endwhile





return 0;


} //end of main function

Help with C++! i don't what this error means and neither how to fix it! help!!!!!!!!!?
It must be cin.getline(); not cin %26gt;%26gt; getline();
Reply:Yes, the person before me is correct:





http://www.cplusplus.com/reference/iostr...





use cin.getline(arg1, arg2). See the referenced link above.


No comments:

Post a Comment