7 Replies - 2377 Views - Last Post: 18 April 2012 - 01:19 PM Rate Topic: -----

#1 Twigz  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 76
  • Joined: 11-July 11

Pseudo Code writing assistance

Posted 17 April 2012 - 05:51 PM

Hello Good evening. There's this program i have to write, but before i start i want to plan it out. So i want to write a nice pseudo code, though i find writing pseudo code is harder than i thought.

Here is the exercise.

1) Write a program using vectors and iterators that allows a user to maintain a list of his favorite games. The program should allow the user to list all the game titles, add a game title, and remove a game title.

My Pseudo Code


1) Accept list of games titles from user.
2) Show titles
3) Offer options to either add or remove a game title.
Allow user to search for game title
if search is succesful give the user the option of removing the title or cancelling
otherwise
report that there is no such title
ask user to search again
4) update game titles
also show all games removed from list
5)show all game titles
6) offer option to exit program


if by any chance, someone can add to this pseudo-code or help me finish it out and make it better that would be greatly appreciated.

Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Pseudo Code writing assistance

#2 darek9576  Icon User is offline

  • D.I.C Lover

Reputation: 198
  • View blog
  • Posts: 1,693
  • Joined: 13-March 10

Re: Pseudo Code writing assistance

Posted 17 April 2012 - 05:55 PM

Thats a shopping list my mum gave me this morning! Where did you get it?
Was This Post Helpful? 0
  • +
  • -

#3 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1432
  • View blog
  • Posts: 4,968
  • Joined: 19-February 09

Re: Pseudo Code writing assistance

Posted 17 April 2012 - 08:56 PM

The program should allow the user to

- list all the game titles,
- add a game title, and
- remove a game title.

ie these three are menu options, and they could be functions (or program sections).
Was This Post Helpful? 0
  • +
  • -

#4 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Pseudo Code writing assistance

Posted 17 April 2012 - 08:57 PM

Present a prompt, asking the user to enter a choice.
Branch off into functions from there.
Was This Post Helpful? 0
  • +
  • -

#5 r.stiltskin  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1833
  • View blog
  • Posts: 4,927
  • Joined: 27-December 05

Re: Pseudo Code writing assistance

Posted 17 April 2012 - 10:01 PM

What you wrote in #1 isn't pseudocode for a program. It's a broad overview or outline of the tasks the program will perform.

Pseudocode should be just as detailed as an actual program, the only difference being that whereas a program must adhere to the syntactic rules of a particular programming language, pseudocode is expressed in ordinary or "natural" language. But it has to provide an exact, step by step algorithm to perform every task, every function, that the program is going to perform.

Think "recipe".
Was This Post Helpful? 0
  • +
  • -

#6 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 644
  • Joined: 03-April 12

Re: Pseudo Code writing assistance

Posted 17 April 2012 - 11:07 PM

I don't agree the pseudocode should be as detailed as the program code.

Pseudocode should be like "human level" program.

You can use "clauses" like "store info to disk file" if the way to do it is straight-forward and not interesting even if in program code it would take hundreds of lines.

Basically you describe the "algorithm" or "working principle".

This might be a bit too high level...

The main thing is that the logic is shown.
Was This Post Helpful? 0
  • +
  • -

#7 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 857
  • View blog
  • Posts: 2,343
  • Joined: 20-August 07

Re: Pseudo Code writing assistance

Posted 18 April 2012 - 01:13 PM

What you've written looks a bit more more like a first attempt at writing a Story than pseudocode. This isn't a bad thing (although as a story, you could do with some refinement), however the purpose of a Story is to act as a starting point to describe what your program is going to do, whereas pseudocode describes how the program is going to do it.


There's some examples (and a pseudocode standard) Here which explain a bit more about the hows/whys of pseudocode.
Was This Post Helpful? 0
  • +
  • -

#8 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 498
  • View blog
  • Posts: 3,317
  • Joined: 12-January 10

Re: Pseudo Code writing assistance

Posted 18 April 2012 - 01:19 PM

Pseudo code should look like this well i like it this way...

get user input

If user enters number
then something happens
else
something else happens

and so on
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1