Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any help would be appreciated
#1
Thanks for your help....
Reply
#2
Guerra, these are real sticky programs. I doubt that they can be finished and working this week. How long ago did you know about these assignments?

PROGRAM #1. The teacher is deliberately making this difficult. One problem that I see is that the same state could be spelled differently which would cause the program to stick it into the array twice. Eventually this spelling error would cause the array of 50 elements to overflow and QB giving a susbscipt out of range error or perhaps if the program detects this, a program issued fatal error.

I would set up 50 DATA statements with the correct spelling of the states in alphabetical order. Then READ these into an array like: DIM SNAMES$(1 TO 50).
Also set up a states-used array as STATES(1 TO 50). This STATES array is initially all zeros. A zero in the corresponding element position of the STATES array means the state is not used yet.

When the user gives you a state name, you first look it up in the SNAMES$ array. If it's not found, then the spelling is wrong.
If you find it, save the position in the SNAME$ array as an index. Go to STATES(index). If you're adding and this element is not zero, then report a duplicate, else if it's zero, mark it as added by putting a 1 in this element.

If you're deleting, then the element should be a 1, else it's an error. If it's 1, make it a 0.

To generate a list of the states entered, loop through the STATES array using an index, and when the element in STATES is 1, then print the corresponding name from the SNAME$ array using the index.

That's about it, I think. Simple I think, and not having to insert elements into the middle of an array.

PROGRAM #2 and PROGRAM #3 seem fairly easy, with #3 being the easiest by placing all the data into DATA statements. You're on your own with PROGRAM #4, I don't use Random files.

Good luck..... Moneo
Reply
#3
I thought protocol was no homework...
In the beginning, there is darkness – the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Reply
#4
Quote:I thought protocol was no homework...
How about I protocol your face!
Reply
#5
It's a hologram. My programming is encrypted with a level 8 quantum security code.
In the beginning, there is darkness – the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Reply
#6
Quote:I thought protocol was no homework...

You're right, but the rule indicates not coding his homework. Giving ideas and hints is allowed.

*****
Reply
#7
Oh... I thought no homework meant absolutely no homework whatsoever.
In the beginning, there is darkness – the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)