0

hi everyone.
i've just started programming techniques and i need help with understanding how to write a module from an algorithm (pseudo code)
i have an assignment to do but i haven't learn anything about modular programming, so i'm in a ditch right now.
can anyone show or help me with some example and explanation of how to do a pseudo code modular program without me posting my assignment.
thanks in advance

3
Contributors
12
Replies
14
Views
9 Years
Discussion Span
Last Post by nova2177
0

sorry i took so long to answer.
asking my professor would be an impossible task, he answer a question by giving another question in parables. sounds funny, thanks for your advise, i'll give it a try and if that doesn't work i'll con tinue hitting the books and scouring the net to see what i can come up with.

0

What exactly are you refering to, when you say 'modular'? You mean how to write a function/procedure based on an algorithm? Or are you trying to write a pseudo-code using some sort or algorithm? Pseudo-code isn't really dependent on any language. I think there is a standardized way of writing pseudo-code, but it's generally written in a form that is the the easiest to understand. Have a look at some examples: http://en.wikipedia.org/wiki/Pseudocode

0

modular or module, i guess to explain this i would say if you write a pseudo-code program or algorithm, then try an take a module out of it.
basically that almost what a part f the question ask, but i haven't done anything like that as yet.

0

Alright, perhaps what you're trying to create is a reusable class which utilizes this algorithm. What languages is this going to be done in? You could probably start looking at object oriented programming. I think that's what you're looking for.

0

it is just straight pseudo-code using the
dowhile statement. it would be something looking like this. lets say
xxxx integer
yyyy integer
xxxx := (X)
yyyy := (Y)
dowhile yyyy = (Z)
println "enter xxxx "
read xxxx
yyyy = yyyy + 1
xxxx = xxxx + yyyyy
enddo
println "xxxx = " xxxx

somehow i would have to make xxxx a module separate from the rest of the program.
something like that, hope you can understand, i'm trying not to post the questions that i got.

0

here is a pseudo-code we did earlier in the course.

Sum integer
Num integer
Count integer
Count:= 0
Sum:=0
Dowhile count <3
Println “Enter Num: ”
Read Num
Sum := Sum + Num
Count:= count + 1
ENDDO
Println “average = ”, Sum/Count

the question would ask something like this. Write a module called sum that will accept an integer value and will return the sum of the squares of the value entered, use the sum module to write an algorithm.

0

That doesn't even make sense. You're talking about a function, not a module, and you're talking about finding a sum when only one argument has been passed.

0

well this is a twist of the arm, all my searches on module and i didn't see anything about function, i guess nothing beats asking a question, i'm doing to do some research on function and see what i understand and if anything i can't make out, i'll give you people a post.
sarehu thanks very much for that reply.

0

That doesn't even make sense. You're talking about a function, not a module, and you're talking about finding a sum when only one argument has been passed.

It's the sum of the squares of a number. You do not need the second number. But yeah, the term module doesn't make sense.
nova2177, modular programming, at least in reference to the old VB, refers to a collections of functions. Generally, a collection of related functions grouped into modules. But it seems like in your case your professor's referring to a function. But i'm not sure and this is why i asked you what language you're using.

0

hi ppls
sorry i took so long, i've been doing some reading, anyway i'm gonna mark this as solved since sarehu pointed me in the right direction, so thanks ppls

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.