Mostly, I'm trying to figure out how to terminate input of a specific type without having to write in some character. Eg
for (int I; std::cin >> I;)
{
List.pushback(I);
}
double Value{};
std::cin >> Value;
If I want to terminate input for the first part, it seems std::cin
keeps whatever I type to tell it to stop taking input, and directly throws it in Value without asking for a new input. Any way to fix that?
Edit for example clarification: Input:
12
34
3
some random character that stops input
23.5
Desired Result
List contains {12;34;3}
Value contains 23.5
Actual result
List contains {12;34;3}
Value contains some random character that stops input now converted