1

Hello all i just started learning c++ an hour ago and I'm encountering this error :

#include "stdafx.h"
#include <iostream>
#include <string>

int main()
{
    using namespace std;
    string name;
    int age;
    cout << "How old are you ?";
    cin >> age;
    cout << "Awesome, what's your name?";
    getline(cin, name);
    cout << "Nice name, " << name << "!";

    return 0;

}

getLine(cin,name) is being totally ignored and directly goes to the next cout and ends like this :

http://puu.sh/9drtu/80449b62ac.png

Thanks.

Shed
  • 97
  • 1
  • 7

0 Answers0