• 0

Psuedocode help...


Question

Hey people sorry to bother you all again

well anyways i'm just trying to clarify some things in psuedo code

the majority says psuedocode doesn't have any pre-defined syntax commands

these are the ones i know.. and found in a text book

BEGIN,END,IF THEN, ELSE, ENDIF, CASEWHERE, OTHERWISE, ENDCASE, WHILE, ENDWHILE, REPEAT, UNTIL

but when i was writing a psuedocode one of my aunty who did abit of programming befoe said u don't use IF = YES OR NO

you have to use TRUE or FALSE instead of YES or NO

so if u have to use true or false then wouldnt that be predefined syntax commands?...

i'm lost

is psuedocode made up or

is the ones above all the ones you would ever see

or is there more

if so can someone show me some other ones with explannations

thanks heaps ppl

Link to comment
Share on other sites

21 answers to this question

Recommended Posts

  • 0

pseudo code is a joke. From personal experiences, its a waste of time.

Pseudo code is made up. It is meant to show you program flow and how different languages work. I find it is much easier to learn basic or c. Pseudo code is just too confusing, especially when total n00bs try and learn a language afterwards. Some people find it easier learning oop this way, but i find learn basic, and learn c. All others are similar, except assembly. It's just plain weird. :s

Programs work with true or false. True and false are usually built in constants. True is 1, false is 0. This is a simple boolean true or false.

Link to comment
Share on other sites

  • 0

but psuedocode is neccessary for our course

in our exams its all tested through psuedo and flow charts how well you understand the structure of the application

Link to comment
Share on other sites

  • 0

Thats a game of symantics, yes/no true/fase are basically the same. Though to be trchnically correct, you should use true/fase since they are more cut and dry than yes/no. Its a squabbly little thing, and since its just pseudo code i wouldn't worr about it.

And I agree that anymore pseudo code is a waste of time, with all the bells and whistles of modern programs, its a waste of time. Though in situations where there is a lot of really dense logic and conditionals, its really handy to make flow charts and the like.

Link to comment
Share on other sites

  • 0

Well since pseudo code is made up, I guess it depends on whoever made up the version you are using. I'd use True/False since it makes a lot more sense, and it is actually used in programs. It makes more sense computer logically anyways.

Link to comment
Share on other sites

  • 0

Hello Winston!

What you're getting confused with (partially) is that TRUE and FALSE are not keywords!. They're just ordinary words that you can use in your pseudocode for binary selection, the condition of loops etc.

e.g.

<pre>

someBool is a Boolean

someInt is an Integer

someInt = User Input

someBool = someInt mod 2

IF someBool = True THEN

    Output "someBool is True (or Yes)!"

ELSE

    Output "someBool is False (or No)!"

ENDIF

</pre>

Other than that remember that True and Yes are the same and False and No are the same. Most of the time you'd use True/False for the reasons Gocalie-CA said

Link to comment
Share on other sites

  • 0

You're studying Year 12 Systems, am I right? :D

The people you've talked to are quite right, there is no pre-defined syntax in pseudocode. I say this with probably the same amount of knowledge on pseudocode as you, but from my understanding (based on nothing but a vague memory from class), pseudocode doesn't have "rules" defining when to use structured english or code, you are free to alternate between the two (applying a bit of common sense of course), therefore if you use structured english (yes or no) and another person, in this case your aunty uses true and false, neither are you are wrong. Like everyone else in this thread has been saying, go with true and false though, it's a little more clear.

Also, try not to take pseudocode too seriously. Although pseudocode may be a dominating feature in your course (or subject is my suspicions are correct, hehe), it's just a bit, well, silly, and a lot of teachers recognise this. You still need to do the pseudocode, but don't get too worried about the theory when creating pseudocode, there may be rules as to how pseudocode has to be written, or not, I'm not sure, but just go with what sounds and feels right and that you think anyone could understand, that's the entire point of pseudocode.

Cheers!

Link to comment
Share on other sites

  • 0

thanks for your replys

im just lose in writing an algortihim

then i got lost in psuedo

say i wanna write an app to find a mean of numbers is this wat i write for psuedo?

BEGIN To FindMean

ask user for numbers

add numbers up

divide result by the amount of numbers added

PRINT result

ask do to another

IF TRUE REPEAT

IF FALSE END.

Link to comment
Share on other sites

  • 0

winston, i'm not sure if the syntax is right but:

<pre>

BEGIN To FindMean 

ask user for numbers //this should be function right!? Functions are 1 word

add numbers up  //should be function, 1 word

divide result by the amount of numbers added 

PRINT result 

ask do to another 

IF TRUE REPEAT //repeat to where?

IF FALSE END.

</pre>

I think you need to be much more clear and specific.

in basic style pseudo i'd do it like this:

<pre>

do

integer (number_of_elements)

dim integer elements(number_of_elements)

for temp = 1 to number_of_elements

elements(temp) = input

next temp

integer sum

for temp = 1 to number_of_elements

size = size + elements(temp)

next temp

integer mean

mean = sum / number_of_elements

print mean

boolean repeat = input "Should I repeat"

while repeat = true

</pre>

Link to comment
Share on other sites

  • 0
i'm not sure if the syntax is right but:

of the syntax isright WHAT???

u said there was no syntax

its made up

see im lost now

thats why i asked ppl are mkaking me soo lost

Link to comment
Share on other sites

  • 0

I have, so far, attended 2 differnt universities, In one the pesudocode was strongly stressed, we would have to submit it as part of the assignment. The other was all about the programming, but pseudocode was strongly reccomended, and on occasion, the psuedocode was the assignment. But in both cases, I was always tought to use true and false. In ant computer, as i'm sure you all know, its 1 and 0. that is as cut and dry as it comes. Any statment that logically evaluates a situation sees it as true or false. Hence, I would say that you should use true or false.

sorry if the grammer or spelling is bad, i must admit thai have drank a bit of alcohol tonight, but i stand firm on using true/false.

If you want help with the actual logic, or just in general, feel free to PM me, or use any of the info in my sig, I mainly have experience with C and C++, and would be more than happy to help ya.

But remember: Ture/False - its how the computer sees it, its how you should phrase it.

Link to comment
Share on other sites

  • 0

Very simply yor code would look like this Winston:

<pre>

BEGIN FindMean

    Choice is a Boolean 

    REPEAT

        ask user for numbers 

        add numbers up  

        divide result by the amount of numbers added 

        Print result 

        Print "Do another?" 

        Choice = User Input

    UNTIL Choice = False

END

</pre>

But you should know how to write it better than that now.

The pseudocode that you need to know it what your teacher tells you because that it was the Board of Studies specifies is the standard for the Software Design course

Might I add that if you don't think about what you're writing, it's very hard to help you. If you write in complete sentences and enclose your code in [ CODE ] [ /CODE ] tags, it is much easier

Link to comment
Share on other sites

  • 0

thanks hornetfighter

well u see im staring to get the pieces together

for the CASEWHERE STATE MENT I GET IT

but the statements like

ENDIF

ENDWHILE

whats thats so suppose to mean in simple english

and also ELSE

Link to comment
Share on other sites

  • 0

Pseudo code is nearly like real code. That means you have to be very specific on the commands.

You use pseudo code in order to learn the general concept of programming. Without the little nasty problems found in the different languages. For example you cant simply read a number from the text-console in Java.

Pseudo code looks often very similar to Pascal or Basic code. Every line in Pseudo code should be easily translated to a real programing language.

So don't simply write "ask user for numbers" or "add numbers up".

The term "IF TRUE REPEAT" is not correct. You have to specify, what to repeat. You must use constructs like

repeat

...

until (...)

or

while (...)

...

do

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.