Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Pascal's Triangle manifesting itself in the output of my array (not intended)?
    text
    copied!<p>I am having a problem getting my Pep/8 assembly program to produce the correct output. The goal is to input a number <em>n</em> followed by <em>n</em> numbers and then have the output place the first number at the end of the array. An example of input and correct output is as follows:</p> <p>"Three numbers of which 1,2, and 3 are in the array." <strong>Input:</strong> 3 1 2 3</p> <p>"The first number in the array, 1, is placed at the end of the array." <strong>Correct Output:</strong> 2 3 1</p> <p><strong>My input and output are:</strong></p> <p><strong>Input:</strong> 3 1 2 3 <strong>Incorrect Output:</strong> 2 2 1 <strong>Desired Output:</strong> 2 3 1</p> <p><strong>Input:</strong> 4 1 2 3 4 <strong>Incorrect Output:</strong> 2 3 3 1 <strong>Desired Output:</strong> 2 3 4 1</p> <p><strong>Input:</strong> 5 1 2 3 4 5 <strong>Incorrect Output:</strong> 2 3 3 4 1 <strong>Desired Output:</strong> 2 3 4 5 1</p> <p>The three parts of my assembly code can be seen at: <a href="http://militarystudents.files.wordpress.com/2009/11/pic1of3.png" rel="nofollow noreferrer">http://militarystudents.files.wordpress.com/2009/11/pic1of3.png</a> <a href="http://militarystudents.files.wordpress.com/2009/11/pic2of3.png" rel="nofollow noreferrer">http://militarystudents.files.wordpress.com/2009/11/pic2of3.png</a> <a href="http://militarystudents.files.wordpress.com/2009/11/pic3of3.png" rel="nofollow noreferrer">http://militarystudents.files.wordpress.com/2009/11/pic3of3.png</a></p> <p>The output for n = 1 and n = 2 comes out correctly. For <em>n</em> > 2 the output seems to repeat a portion of my input. I am using a global array <em>list</em>. Any information will be greatly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload