954,487 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pseudocode

Hi

Need some help writing some pseudocode can anyone help?

alan4545
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

Of course we can. What is your question(s) ?

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Yes.
[edit] Nevermind

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

Im trying to write Pseudocode for these bits of code
Thanks
Alan

void TWQ::getD(AnsiString carNo,Node DInQ[],int& size)
{
aQ=current->getDQ();

aQ.getElement(i+1,nameIn);
DInQ[i].getName();
}

alan4545
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

Describe in your own words what getD() is supposed to do.

Here's the best I can do with what you've posted so far:

1) define method getD() for class TWQ which will have return type void and be passed a copy of an AnsiString object, an array of Node objects, and a reference to an int. Store the AnsiString in a local variable called carNo.

2) assign the value of current->DQ to aQ

3) call the getElement() method belonging to the class that aQ is instance of passing the parameters i + 1 and nameIn

4) call the getName() Node method on the element of DInQ with index i

Can't tell what the real aim of the function is or what each step is supposed to do to achieve that aim without more information as to the purpose of the function and the details of the user defined types.

Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
 
void TWQ::getD(AnsiString carNo,Node DInQ[],int& size) 
{
     aQ=current->getDQ();

    aQ.getElement(i+1,nameIn);
    DInQ[i].getName();
}


Pseudo-code is pretty much a more readable way of printing real code. I find it kind of amusing that you can write the code but have difficulty in writing the psuedo-code :) Normally it's the other way around.

I'm assuming this code runs as you expect.

As such, referring to my brief definition of pseudo-code, it's kind of hard to determine the actual function of the function. If you give us a brief description of what the functions themselves do we will be able to help you. But to be honest if you can do that you shouldn't have any problems writing the pseudo-code anyway!

note: It's always easier when functions have useful names. Not that yours aren't called correctly, I don't know, but by useful I meant that everyone could understand their purpose from reading the code snippet.

twomers
Posting Virtuoso
1,877 posts since May 2007
Reputation Points: 453
Solved Threads: 57
 

hello can anyone help me write a pseudocode statement that declares the variable cost so it can hold real numbers

annaabella
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You