Jump to content
|Topic||Stats||Last action by|
|Happy Birthday Walid!||
|The Big Wrestling Thread!||
|Husband accidentally trades Xbox game with precious family photos inside||
|Have you ever dealt with scammers? I just did. (Somewhat long post)||
Posted 10 April 2013 - 08:27
Posted 10 April 2013 - 08:52
Posted 10 April 2013 - 08:58
Posted 10 April 2013 - 09:08
Posted 10 April 2013 - 09:15
Posted 10 April 2013 - 09:49
Posted 11 April 2013 - 05:37
Record each character into a field
Check field if it contains these
8]CASEWHERE Character encounterstab : Field_count + 1
Posted 11 April 2013 - 06:32
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.
get(data) do( recordcount++ separate out fields based on tab delimiter do what ever you need with data )while (get(data) != "#") print (number of records is) recordcount
Posted 11 April 2013 - 06:53
Begin at the beginning, increase record count along the way when there's a return, till you come to a hash: then stop and return the number.
Posted 11 April 2013 - 07:55
BEGIN MAINPROGRAM Character_count = Null (Real) Field_count = Null (Real) Record_count = Null (Real) File_status = Null (Boolean) Open file REPEAT [indent=1]Record each character into a field[/indent] [indent=1]Check field if it contains these[/indent] [indent=1.8]CASEWHERE Character encounters[/indent] tab : Field_count + 1 return : Record_count +1 # : File_status = EoF OTHERWISE Character_count = Character_count + 1 ENDCASE IF tab is encountered THEN Move onto next field ENDIF UNTIL File_status = EoF END MAINPROGRAM
Posted 11 April 2013 - 10:32