Qbasicnews.com

Full Version: need help FAST! really short program help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have an exam, and i'm a little shady on some parts, and i need some help about setting up a program to do the following:

-read a file (sequential or randomize access) I KNOW HOW TO DO THIS PART
-dump info into an array
-edit the array (adding or deleting)
-write to the file opposite of what is read (i.e if seq. is made, write RA) I CAN DO THIS TOO

if somebody could pseudocode a little piece that would be helpful ...i dont care which choice you choose in the parenthesis

thank you

Anonymous

here ill post something equally useful

Big Grin Smile :normal: Sad Cry 8) :lol: :king: :barf: :rotfl: :evil: :roll: Tongue :x :bounce:



and dont forget :whitetiger:
http://forum.qbasicnews.com/viewtopic.php?t=2131
hehe what you posted kinda is psuedocode =P

Quote:and dont forget :whitetiger:
ph34r!
Quintox,

Don't mind the kidding from the guys, but normally we are not supposed to help people with their school homework. In your case, I'm going to consider it as help for a test, as you said.

What you're doing sounds like an editor program, like notepad. Read the file in, change it (add or delete), then write it back out. But, I'm sure you don't want to write a full-blown editor.

A few questions:

1) Is there some "key" associated with each record on your input file? Like maybe a name or some kind of record number, like a member number? If so, how many bytes is the maximum key? Is the key numeric?

Using a numeric "key", you can store the input records into an array by the key, and then ask the user for a key to add or delete. If it's not in the array, you can add. If it's in the array, you can delete (or change).

2) If you are not using a "key", then you don't really need to put all the data records into an array, unless you want the option of adding a record and later in the same run, deleting it.

2) If you are not using a "key", then to add a new record, you could just add it on the end of the file.

3) If you're not using a key, to delete a record you would have to display each record asking the user if he wants to delete or not. Also, wouldn't you need the option of changing a record?

Answer these questions so that I can help you more.
*****