![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jul 2008
Posts: 2
OS: xp pro and vista home basic
|
pseudo-code (modular program)
have an pseudo-code assignment to finish but i am stuck on how to get a module from the pseudo-code that i have written, i have never done anything about module more than what it means. i don't know if anyone can show me from this example. don't worry this is not the assignment i got.
sum integer num integer count integer sum := 0 count := 0 dowhile count < 3 println "enter num: " read num sum := sum + num count := count + 1 enddo println "average = " sum/count is there any way this can be divided into module(s), or you can show me any other examples thanks much. |
|
|
|
|
|
#2 (permalink) |
|
TSF Enthusiast
Join Date: Jul 2007
Location: Northampton, UK
Posts: 914
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: pseudo-code (modular program)
Hey, i don't see anything here which needs to be modular... I believe the meaning for module is a block of code which may be re-used... e.g. how we use functions/procedures rather than re-writing code millions of times... Or the same for Iteration statements, we use them to re-run a block of code(module) a number of times...
A good example would be an output routine like outputting the state of a few variables at any one time, usually i'd expect to see something like : (I don't know the notation you use for modules/procedures etc) Code:
... procedure outputStateOfVars; begin println sum println count end (here you would mess with the variables) sum := 1 count := 1 (then output them) outputStateOfvars; (then mess with them some more) sum := count+5; (then output them again) outputStateOfVars; (Wiki is a good resource no-matter what the news says) which kind of sums it up, we use modules to make code more easily maintainable and to allow code re-use. If you need more help then post back with your queries, to be honest it's hard for me to explain modularity because it's just something that's a constant in my mind. |
|
|
|
![]() |
| Thread Tools | |
|
|