0 Replies - 577 Views - Last Post: 01 October 2012 - 04:12 PM Rate Topic: -----

#1 TheOne6152  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 11-February 09

Pep/8 How do I output on same line

Posted 01 October 2012 - 04:12 PM

I am brand new to pep/8 like 5 hours new to it. My teacher wants us to input four variables (W,X,Y,Z) and then preform these calculations and out put them in that format:

W + X =
Y + Z =
(W + X) + (Y + Z) =

I can do the calculations perfectly, but I cant seem to out put them on the same line, they always space down a line after I input a variable.

Here is my code so far:
         BR                  main
sum1:    .BLOCK 2
sum2:    .BLOCK 2
sum3:    .BLOCK 2
num1:    .BLOCK 2            
num2:    .BLOCK 2
num3:    .BLOCK 2
num4:    .BLOCK 2

main:    CHARO               '(',i
         LDA                 sum1,d
         DECI                num1,d
         ADDA                num1,d
         CHARO               '-',i
         DECI                num2,d
         SUBA                num2,d
         CHARO               ')',i
         STA                 sum1,d
         CHARO               '+',i
         CHARO               '(',i
         LDA                 sum2,d
         DECI                num3,d
         ADDA                num3,d
         CHARO               '-',i
         DECI                num4,d 
         SUBA                num4,d
         CHARO               ')',i
         STA                 sum2,d
         CHARO               '=',i
         LDA                 sum3,d
         ADDA                sum1,d
         ADDA                sum2,d
         STA                 sum3,d
         DECO                sum3,d

I also have to output our first and last name, but I dont know how to fit my name into one block. all and any help is greatly appreciated. thank you

Is This A Good Question/Topic? 0
  • +

Page 1 of 1