2012-06-27 6 views
-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. 
`     
+3

무엇이 당신의 질문입니까? – robert

+0

관심있는 다른 리소스 : [처음부터 프로그래밍] (http://savannah.nongnu.org/projects/pgubook/), Jonathan Barlett – paulsm4

+0

@robert 질문은 암시 적입니다. "어떻게 다른 사람을 찾을 수 있습니까? 내 임무를 다하니? ". 요즘 그들은 질문에 대한 과제를 재구성하지 않아도됩니다. – hirschhornsalz

답변

0

"소수 목록을 생성하는 주 프로그램을 작성하십시오." 이것이 당신의 기본적인 질문입니다. 자세한 내용은 나중에 답변을 제공하는 데 도움이됩니다.

"PrimeTest 서브 루틴을 사용하여 숫자 2, 3, 4, 5, 6 ...256이 각각 소수인지 여부를 테스트해야합니다." 이 부분을 할 수 있습니까? 그렇지 않다면, 할 수있는 최선의 코드를 작성하고 여기에 다시 질문하십시오.

"소수로 판명 된 각 번호는 메모리의 목록에 추가되어야합니다." 이 부분을 할 수 있습니까? 그렇지 않다면, 할 수있는 최선의 코드를 작성하고 여기에 다시 질문하십시오.

"소수 목록은 연속적인 메모리 위치에 저장되어야합니다." 이 부분을 할 수 있습니까? 그렇지 않다면, 할 수있는 최선의 코드를 작성하고 여기에 다시 질문하십시오.

"StartPrimeList라는 이름의 위치를 ​​사용하여 소수 목록의 시작 주소를 가리 킵니다." 지금까지 메시지를 받았어 야합니다. 질문 자체에 제공된 훌륭한 조언을 사용하여 도움을 받으십시오. 코드를 작성하십시오. 작동한다면 괜찮아요. 그런 다음 여기에 게시하여 그것이 무엇을해야하며 문제가 무엇이라고 생각하는지 설명하십시오. 시도한 내용과 문제를 해결하지 못한 내용을 알려주십시오. 그것은 우리가 당신의 일을 반복해야하는 것을 도와 줄 것입니다.

귀하의 프로그램을 작성하지 않습니다. 당신은 그것을 써야합니다. 우리는 도움을 당신이 쓸 수 있습니다.