This is my code:
#include <iostream>
#include <vector>
using namespace std;
int main(){
int x=-1;
while(x != 0)
{
x = 0;
cout << "nuevo numero: ";
cin >> noskipws >> x;
cout << x << endl;;
}
}
and the output is:
nuevo numero: 5 // I input that number
5
nuevo numero: // Here it doesn't wait for an input
0 // I don't know where this come from, guess it's the empty input
I know this is related to the noskipws
, but I don't know the exact reason nor how to fix it.
QUESTION: Why the second cin >> noskipws
doesn't wait for input? How can I fix it?