Thank you for all your precious advices. 'a' is before LOOP: because you don't need to reinsert that value since in evrey function (if-else) n(the result of the operation)=a. So you can do
2
+
3
=
5 here you type the next operation for example * wich is 'b'
2 wich is c
=
10 wich is d.
and so on.
As you can see the result takes itself the place of 'a', that's why LOOP: is after 'a'.
Any other advice or consideration?
I changed the structure of the function as you suggested me; there is no need to press '=' after every operation; you can type the whole calculation in one line and get a less "ugly" output like this:
2+4+5*2/2 (press enter and not '=')
2+4=6;
6+5=11;
11*2=22:
22/2=11;
Looks better?
It is quite difficult for me to fully understand the whole code since i started programming in c++ from less than a week. However i don't understand what's the problem with using the goto statement(i apologize for the noob question).
Alright, i got it.However i'm trying to use a while or do-while instead of the goto statement but i just can't figure out how to do it whithout massive modification of the code.Any idea?
The code is quite a leap to begin with, but if you have an interactive environment like Visual Studio or XCode, you can step thru the program one line at a time. You'll learn quite a lot from it.
The calculator allows to you make simple variable assignements (as in BASIC) and go on to use them in further operations. It's pretty cool.
Thank you, i'm looking at that right now and i find it really useful!I didn't know it existed even!By the way, what calculator are you talking about?Mine or the one posted in the link?
However i'm trying to use a while or do-while instead of the goto statement but i just can't figure out how to do it without massive modification of the code.
If you want to add a do-while loop in your code, you don't have to change much things:
replace LOOP: with do{
and goto LOOP; with }while(true);