Use indentation to make it easier to read your code.
I agree with everything Moschops says except for the last thing. There is no reason to have a return statement in main unless you return something else than 0.
You get errors because you removed usingnamespace std; and didn't add std:: in front of all the standard functions, types and objects. std::cout, std::cin, ...
Thank you everyone just another quick one when i break out of the case for + where does it take the program?
Im just getting a bit confused as It keeps taking back to the addition case!
Would I have wipe whatevers stored in the operation variable ?
Thankyou Peter87 ive added a few more things but the while loop ive added doesnt seem to be registering the yes or no inputed into the script at the moment ive got this while(qu != 'N' || 'Y')
and from what ive learnt it should loop until a Y or N is inputed could you see why this wouldnt work ?
Im still to read up on the namespace thing just going with adding std:: to everything at the moment any this is my whole script I want it to basically only carry on after the first calucation after the user has inputed if they want to or not
p.s i have only changed the addition case
Think of a namespace as a last name. If I say "Stan," it's ambiguous; there might be many "Stan's." But, if I say "Stan Smith," it's unambiguous.; you know exactly which "Stan" I'm talking about. (Of course, in C++ there can be only one Stan in the Smith family, and all Smith's are in the same family. Also, "Stan Smith" would be written Smith::Stan.)
So by saying usingnamespace Smith; Your saying, look for all identifiers (names) in both the global namespace (the family that has no last name) as well as the Smith namespace (Smith family.)
Saying using Smith::Stan says saying "Stan" from now on is enough to find Smith::Stan (Stan Smith.)
As for your problem, I suggest taking care to indent your program better, and maybe comment which control structures those breaks are for. That might help you follow your own logic better so you can debug the program. I see a few places were your writing redundant code.
C++ programs are not "scripts." A script is interpreted/parsed. C++ is compiled into machine code, i.e. a natively executable file/program.
Ok so ill comment on the code to show you where its not working and thank you for that explanation very helpfull im going to purchase a c++ book soon I found that, that helped with php anyway
If qu is N, then the one on the right is true, so the whole OR statement is true.
If qu is Y, then the one on the left is true, so the whole OR statement is true.
If qu is something else, then the one on the left is true and the one on the right is true , so the whole OR statement is true.
This will always come out as true so this will loop forever.
I thought if you had qu != 'N' || qu != 'Y' and qu is N or Y then it would be false and the script would continue. IF anything else was entered it would loop till Y or N was inputed.
I thought if you had qu != 'N' || qu != 'Y' and qu is N or Y then it would be false and the script would continue.
That's incorrect. If qu is N or Y, only one side of the || is false. The other side is TRUE, and when an || has TRUE on one side, the final answer is TRUE.
The != does return true if they dont match ?
That's correct.
qu != 'N' || qu != 'Y'
If qu is N, then the one on the right is true, so the whole OR statement is true.
If qu is Y, then the one on the left is true, so the whole OR statement is true.
If qu is something else, then the one on the left is true and the one on the right is true , so the whole OR statement is true.
Ah lmao I was tired when writing this and still am now lol thanks for your help but i cant see of a way to get round this is there some sort of match function that will take the variable and check if it is equall to Y or N?