Thread: Pseudocode help to understand what the question is asking

  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    3

    Pseudocode help to understand what the question is asking

    Record separation problem
    Let us assume that a particular database program manages a simple mailing list which consists of one record for each person on the list, and a number of fields containing information about each person (their name, address, etc). The program can read in data produced by a word processor provided that data is structured in the following way
    Each record to be read must be a single paragraph terminated by a return character, and each field within a record is separated by a tab character. For Example:

    Colin Jameson|tab|33Falcon Street|tab|Waverly|tab|NSW|tab|2114|return|

    Would be read as one record containing five fields. The end of the data is marked with the # (Hash) character which immediately follows the return ending the last paragraph.

    Assuming that there is at least one line of valid data at the start of the input file, describe an algorithm that the program might use to read such data one character at a time and place the information into separate fields and records. The algorithm reports the number of records read when all records have been processed.
    The question as said above I'm trying to understand it as to what it's asking from me is it asking for me to create a pseudocode which sorts random details into the form as shown above or to create like a database with everything sorted out? I was given a hint to use a array but I have no idea how.

  2. #2
    Time-Lord Victorious! The Doctor's Avatar
    Join Date
    Aug 2012
    Location
    Perth, Western Australia
    Posts
    50
    We won't do your homework for you, mate. That wouldn't help you in the long run.

    I'll give you a hint: Character strings are implemented as char arrays in C. That might be what you need to know.

    Check out this link for more information on how character strings are handled in the C language: C Strings - Cprogramming.com
    Last edited by The Doctor; 04-10-2013 at 03:22 AM.
    Code:
    if (codeWorks( code) && !youCanDoSomethingBetter( code) )
    {
         beHappy();
    } else
    {
         fixCode( code);
    }

  3. #3
    Registered User
    Join Date
    Apr 2013
    Posts
    3
    Quote Originally Posted by The Doctor View Post
    We won't do your homework for you, mate. That wouldn't help you in the long run.

    I'll give you a hint: Character strings are implemented as char arrays in C. That might be what you need to know.

    Check out this link for more information on how character strings are handled in the C language: C Strings - Cprogramming.com
    Not asking for you to do my homework just clarify what exactly it wants me to do I know it wants me to create a code which makes it readable by the computer but I have no idea what do I do with the array hint I was given and what a array is in pseudocode.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    The question actually says nothing about pseudocode.

    All it is asking you to do is describe an algorithm: a sequence of steps that meet some purpose. There is not even a need to write code. The requirement is to describe the sequence of steps in enough detail, and without ambiguity. You need to provide enough information so someone could start with required inputs, and correctly produce the required results.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #5
    Registered User
    Join Date
    Apr 2013
    Posts
    3
    Quote Originally Posted by grumpy View Post
    The question actually says nothing about pseudocode.

    All it is asking you to do is describe an algorithm: a sequence of steps that meet some purpose. There is not even a need to write code. The requirement is to describe the sequence of steps in enough detail, and without ambiguity. You need to provide enough information so someone could start with required inputs, and correctly produce the required results.
    It doesn't say anything about it but I was told to write a algorithm in pseudocode

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Occidio View Post
    It doesn't say anything about it but I was told to write a algorithm in pseudocode
    That's one way of doing it, but certainly not the only way.

    Pseudocode is just a description that has some superficial resemblance to code, but is not really (i.e. it is mainly written for human understanding, not for parsing by a computer).

    There is certainly no standard way of writing pseudocode.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  7. #7
    Time-Lord Victorious! The Doctor's Avatar
    Join Date
    Aug 2012
    Location
    Perth, Western Australia
    Posts
    50
    My advice on looking up char arrays still holds though.
    Code:
    if (codeWorks( code) && !youCanDoSomethingBetter( code) )
    {
         beHappy();
    } else
    {
         fixCode( code);
    }

  8. #8
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    The best way that I've found to do this sort of thing is to open a text editor (like notepad) and have a pen and paper ready.

    Start typing what you want to see writing down every step as you do it.

    Maybe start with: Prompt user for input "Enter record that blah blah.. seporated by blah blah.. and ending with blah blah.."

    Then as you continue, write down all the things that you want your program to do as you do it on your text editor.
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. please help me to understand the question
    By jollykiddo in forum C Programming
    Replies: 7
    Last Post: 12-18-2011, 09:44 AM
  2. Please help me to understand this question
    By maatata in forum C Programming
    Replies: 7
    Last Post: 11-28-2011, 06:16 PM
  3. Please help me understand this question on c++
    By darksifer in forum C++ Programming
    Replies: 4
    Last Post: 04-14-2011, 06:34 AM
  4. I could not understand this question
    By enggabhinandan in forum C Programming
    Replies: 3
    Last Post: 10-22-2006, 05:17 AM
  5. To understand the question....
    By Forever82 in forum C++ Programming
    Replies: 1
    Last Post: 07-20-2003, 10:11 AM