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

Recommended Answers

All 12 Replies

There is no universal definition of 'module'. Ask your professor for details.

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.

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

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.

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.

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
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.

We don't understand. xxxx is a variable. What does that have to do with modules?

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

Sum integer
Num integer
Count integer
Count:= 0
Dowhile count <3
Println “Enter Num: ”
Read Num
Sum := Sum + Num
Count:= count + 1
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.

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.

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.

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.