Post Reply 
Local variables - C Style
11-07-2015, 02:06 PM (This post was last modified: 11-07-2015 02:29 PM by Gerson W. Barbosa.)
Post: #5
RE: Local variables - C Style
Ciao Alen12345,

The following is a close translation of your c++ program:

Code:

« 2 3                         ; Dati
  0 0 0 ->  a b c d f         ; a=2; b=3; c=0; d=0; f=0
                              ; Risoluzione
  « a b + 'c' STO             ; c=a+b
      c SQ 'd' STO            ; d=c*c 
      'c*c*c+d' EVAL 'f' STO  ; f=c*c*c+d
      f "Risultato" ->TAG     ; cout<<"Risultato: "<<f<<endl                              
  » 
»

If you want to use local variables c, d and f in the inner structure, then you have to create and initialize them beforehand.
Peacecalc's program above makes more sense in RPL, but for longer and more complicated programs a mix of stack operations, local variables and algebraic expressions might be easier to accomplish.

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Local variables - C Style - alen12345 - 11-07-2015, 09:08 AM
RE: Local variables - C Style - Han - 11-07-2015, 12:28 PM
RE: Local variables - C Style - alen12345 - 11-07-2015, 12:48 PM
RE: Local variables - C Style - peacecalc - 11-07-2015, 01:41 PM
RE: Local variables - C Style - Gerson W. Barbosa - 11-07-2015 02:06 PM
RE: Local variables - C Style - C.Ret - 11-08-2015, 02:52 PM
RE: Local variables - C Style - peacecalc - 11-08-2015, 07:28 PM



User(s) browsing this thread: 1 Guest(s)