cin.ignore
Hello guys,
I am very close to finding a solution to getting my code to run correctly.
I need to create a cin.ignore that says the following;
ignore this '1' - this one is any character
UNLESS it's a negative - or any number from 0 to 9
So far I have this but it ignores 1 always.
even if i start my input with a number.
1 2 3 4 5 6 7 8 9 10 11 12
|
cin.ignore(1,'-' || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9||0);
cin >> num1;
cin >> function;
function = tolower(function);
if (function == '|')
{
cin.ignore(numeric_limits < std::streamsize>::max(),'\n');
}
else
cin >> num2;
|
Topic archived. No new replies allowed.