Hi

Need some help writing some pseudocode can anyone help?

Recommended Answers

All 6 Replies

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

Yes.
[edit] Nevermind

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.getName();
}

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.

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.

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

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.