first of all, I was too lazy to type out nSelection
You saved a massive one character with "nSelector" instead of "nSelection", you know.
And we've wasted more on the after-talk. Didn't look like a typo, and I really wanted to make sure we were talking about the same thing.
and it is withen the loop, but the cin nSelection isn't in the loop in a way that it would EVER be called more than once,
"Please enter 1, 2, 3 or 4:"
<enters '5'>
"Please enter 1, 2, 3 or 4:"
<enters '9'>
"Please enter 1, 2, 3 or 4:"
<enters '2'>
"Finally, right, now I'll do the calculation you desire..."
as soon as you enter a number / assign a number to nSelection that while expression equals 0,
so you'll never be able to cin >> nSelection again.
Which is how I saw the program as being 'designed' to work. After asking for the two initial numbers to work with ask (by way of a multichoice) for a
single operation to apply to them. Keep asking until it's a valid choice, then do the appropriate operation and exit.
You were thinking it should repeat the choice? I'd also surround the two initial 'data' numbers as well as the 'operation' choice number (or other key).
In which case, make sure there's a "I don't want to do anything more with this" choice on the menu, otherwise you can
only terminate the program by a Ctrl-C/equivalent. Perhaps double loop it with a "finished with these numbers, break out of the 'operator choice loop' and hit the 'data numbers input loop' repeater, as well as an option that breaks out of this second one as well.
RedoAllLoop:
Set NewNums as True
Ask for two numbers to calculate with
RedoOperationLoop:
Set NewOp as True
Ask for operation to apply
Case Operator 1 -> do Operation1 on Numbers; break out of Case
Case Operator 2 -> do Operation2 on Numbers; break out of Case
...Operator 3, 4, any more, ditto...
Case NewNumbers -> Set NewOp=False; break
Case Finished -> Set NewNums=False; break
Case anythingelse -> Tell the user they did it wrong; (optional) break
repeat RedoOperationLoop while(NewOp && NewNums)
repeat RedoAllLoop while(NewNums)
Goodbye...
As to the char==value, some languages are 'loose' with values being equatable to value-evaluated strings. Perl, for example and if I've not made a thinko as I type this, has "if ($x == 0)" and "if ($x == '0')" and "if ($x eq '0')" being the same (and also "if (!$x)", but that would also catch it being undefined, which you might want, but maybe don't)...
Powerful, but prone to error.
If you want to work at a very low level, bitwise (by whatever operators the language you use provides), you can convert ASCII numbers to decimals by ANDing the char's ordinal value with 15, but it isn't foolproof (all characters give values, and across 0..15). Prevalidating by aiming to see zero come out of the ordinal value ANDed with 192, first, helps, and then non-zero from the ordinal ANDed with 48 but you've still got more out-of-range numbers (for decimal), and it rapidly gets complicated if you've not got a neat 0..2
n-1 range, and so instead of 1..4 I'd go for 0..3, ORing out the last two bits once I had checked it matches "001100??" (two checking operations needed, either in series or chained together). Matching 1..4 would mean "00110???" as the template, but then take measures to exclude the four other values that could include. And, besides, that's unnecessarily complicated for anything beyond low-level. And I may have typoed/thinkoed along the way, and I'd need to properly go through it to be
absolutely sure I've covered all the truth-table possibilities...
edited for a couple of thinkos/typos, more probably remain...