prompts running together question

if i input u1776alex 12.9 on the first prompt, why do the rest of them run simultaneously and distributes the values into the variables?


cout << "Please input a character";
cin >> characterOne;

cout << "Please input a number value";
cin >> numbVal;

cout << "Please input second character";
cin >> characterTwo;

cout << "Input your name";
cin >> name;

cout << "Please input a float value";
cin >> floNumb;




















Because everything you type will be stored in input buffer. It is like a queue of characters.
Input operation will take as much as they can (one non-whitespace character for char, up to first non-digit for ints, up until first whitespace for string, etc.), leaving the rest in that buffer. As soon as it is exhausted, you will be prompted to input next line. So if you provide enough info for several input oprations, they will run without interruption
ok thanks
Topic archived. No new replies allowed.