cin in c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziko
    New Member
    • Jun 2010
    • 2

    #1

    cin in c++

    I've started to explore c++ recently and I was using cin to get input from a user but it always misses the first character for example:
    string name;
    cin >> name;
    cout << name << endl;
    (if i wrote Tom for example on the console)
    the result will be only : om
    Can anybody help me with this kind of problem?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    The code you posted should work. Are you sure you havent't fetched a character before this?

    You might post the code that precedes the code you have shown.

    Comment

    Working...