-3

まず、これが宿題ではないことを証明したいhttp://computer.atlas4e.com/

私は自分でコンピューターの基本を理解しようとしているので、これを説明して理解する必要があります。助けてくれてありがとう

`Prime Number List Program 
Write a main program that generates a list of prime numbers. The program should use the PrimeTest subroutine to test whether each of the numbers 2, 3, 4, 5, 6…, 255 & 256 is a prime. Each number that is found to be a prime should be added to a list in memory. The list of primes should be stored in consecutive memory locations.  Use a location named StartPrimeList to point to the start address of the prime number list. Use a pointer called PrimeListPtr to point to the (current) end of the list, PrimeListPtr will be incremented every time a prime number is appended to the list.
Use a location named PrN to store the number that you are checking. Start by storing a 2 in PrN. In a loop, you should call PrimeTest to determine whether PrN is a prime. If PrN is a prime, then append it to the list. Then add 1 to PrN and jump back to the start of the loop to test the next value of PrN.`
The output of the program should appear starting at location StartPrimeList as follows:-
Address Contents
 [StartPrimeList]   2
[StartPrimeList+1]  3
[StartPrimeList+2]  5
[StartPrimeList+3]  7
    …
    …
[StartPrimeList+?]  Largest Prime <= 256

(251 - 54th prime number starting from 2 <=256)
(257 - 55th prime number >256)

`

Mark Allocations for Program 2

•   A program header in the program listing explaining how the program works.   
•   Sensible/Relevant program comments on sections of assembler language.       
•   Relevant labelling of loops and data items.                         [4]
•   Program runs successfully on xComputer and produces correct output for given input. 
`                 
4

1 に答える 1

0

「素数のリストを生成するメインプログラムを書きなさい。」これはあなたの基本的な質問です。詳細は後で説明しますので、回答に役立ててください。

「プログラムは、PrimeTest サブルーチンを使用して、2、3、4、5、6…、255、および 256 の各数値が素数であるかどうかをテストする必要があります。」この部分はできますか?そうでない場合は、それを実行するための最善のコードを書き、ここで具体的な質問をしてください。

「素数であることが判明した各数値は、メモリ内のリストに追加する必要があります。」この部分はできますか?そうでない場合は、それを実行するための最善のコードを書き、ここで具体的な質問をしてください。

「素数のリストは、連続したメモリ位置に保存する必要があります。」この部分はできますか?そうでない場合は、それを実行するための最善のコードを書き、ここで具体的な質問をしてください。

「StartPrimeList という名前の場所を使用して、素数リストの開始アドレスを指定します。」あなたは今までにメッセージを受け取っているはずです。質問自体に記載されている優れたアドバイスを参考にしてください。コードを書きます。それが機能する場合は、問題ありません。そうでない場合は、ここに投稿し、何をすべきか、何が問題であると考えられるかを説明してください。試したことと、問題が解決しなかったことを教えてください。そうすれば、あなたの仕事を繰り返さなければならなくなります。

私たちはあなたのためにあなたのプログラムを書きません。あなたはそれを書かなければなりません。私たちはあなたがそれを書くのを手伝います。

于 2012-06-29T21:42:48.520 に答える