Re: a question about cin



Jefe wrote:

Tnx Ulrich for you reply but now I have another problem, my Visual Studio.Net compiler says there is an error at "while (cin >>s)" line and it said that "error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)" what should I do now????

You should make sure you are including the correct header files. As Jochen indicated, you should have:


#include <string>
#include <iostream>
using namespace std;

If you were using

#include <iostream.h>

you need to get yourself a new book on C++.

HTH,

David Wilkinson
.



Relevant Pages

  • Re: [C, C++] "(a=b) = c;" Illegal or Undefined?
    ... What I am saying is that a compiler might look ... order of evaluation of the left and right operand is unspecified. ... occurs somewhere during the previous and next sequence point. ... assignment and 4 after assignment. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Multiple Assignment Evaluation Debate
    ... have no right to expect anything in particular, because a compiler ... "int", it will still have 3 in it later. ... An assignment operator stores a value in the object ... designated by the left operand. ...
    (comp.lang.c)
  • Re: Im a newb!!
    ... cin and cout are rather peculiar things. ... pre-assigned by the compiler before the compiler lets you get control of the ... You want output to go to a file instead of the monitor; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Ambiguity in semantics of assignments?
    ... > on the compiler. ... the left operand after the assignment, ... The type of an assignment expression is the type of the left ...
    (comp.lang.c)
  • Re: Negative values for shift operators.
    ... > K&R states that the right operand must be non-negative. ... Just because MSVC7 did that, ... that's what the current standard states as well. ... a compiler and the standard, ...
    (comp.lang.c)