🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

5 total messages Started by David Tiberio Sun, 12 Apr 1992 01:14
pascal trouble
#2
Author: David Tiberio
Date: Sun, 12 Apr 1992 01:14
22 lines
1462 bytes
	I am doing a sort routine for my database. Unfortunately,
all of the empty cells are being placed first in the record
while all of my real data is at the end. I have thought of ways
of living with this, but would rather get those blank cells at the
end. 

	I have tried making a null string, and checking if each 
name in the record is greater or lower, but it is finding that all
of them are lower, which doesn't help. I even changed the null to a
real name and it still didn't work; it just erased my data up until
that point. 

	What is the best way to set a name to a null? I have a string
of 50 characters. The only easy way I have thought of is to change
the name to all z's. Is there another way to do this? maybe a higher
ascii code?

-- 
      //   David Tiberio  SUNY Stony Brook 2-3662  AMIGA  DDD-MEN   
     //  Not the llama! Come here Earl; I want to tell you something...
   \X/  Liverpool, New York	flames to suggestions@cbmvax.commodore.com
Re: pascal trouble
#3
Author: David Tiberio
Date: Sun, 12 Apr 1992 02:41
17 lines
1242 bytes
	I have to do a database option where the user presses
RETURN if he does not want the data changed. The string read
in is an array of length 9. This is what I tried:

	if string = '         ' then data_does_not_change;

	This line is not being read for some reason the way
I would expect it to. Should this work? It could be that I forgot
something somewhere else, but I have had problems like this
throughout this program.


-- 
      //   David Tiberio  SUNY Stony Brook 2-3662  AMIGA  DDD-MEN   
     //  Not the llama! Come here Earl; I want to tell you something...
   \X/  Liverpool, New York	flames to suggestions@cbmvax.commodore.com
Re: pascal trouble
#4
Author: David Tiberio
Date: Sun, 12 Apr 1992 03:44
34 lines
1872 bytes
In article <1992Apr12.024103.27635@sbcs.sunysb.edu> dtiberio@csws7.ic.sunysb.edu (David Tiberio) writes:
>
>	I have to do a database option where the user presses
>RETURN if he does not want the data changed. The string read
>in is an array of length 9. This is what I tried:
>
>	if string = '         ' then data_does_not_change;
>
>	This line is not being read for some reason the way
>I would expect it to. Should this work? It could be that I forgot
>something somewhere else, but I have had problems like this
>throughout this program.

	I solved this problem. It ends up I was messing
with the difficulty string instead of the name string!
Well, at least it only took me a few hours this time...


David Tiberio - user of Standard Pascal, the Miracle Language

I can't wait to start writing operating systems in Pascal. Or maybe
some artificial intelligence software that can write Pascal programs.
It would probably get a better grade then I would, so I could use
it to do my homework assignments.



				Sincerely,
				R2x ver 2.03.01

-- 
      //   David Tiberio  SUNY Stony Brook 2-3662  AMIGA  DDD-MEN   
     //  Not the llama! Come here Earl; I want to tell you something...
   \X/  Liverpool, New York	flames to suggestions@cbmvax.commodore.com
Re: pascal trouble
#6
Author: SpaceMan Spiff?
Date: Sun, 12 Apr 1992 13:24
36 lines
1719 bytes
In article <1992Apr12.024103.27635@sbcs.sunysb.edu> dtiberio@csws7.ic.sunysb.edu (David Tiberio) writes:
>
>	I have to do a database option where the user presses
>RETURN if he does not want the data changed. The string read
>in is an array of length 9. This is what I tried:
>
>	if string = '         ' then data_does_not_change;
>
>	This line is not being read for some reason the way
>I would expect it to. Should this work? It could be that I forgot
>something somewhere else, but I have had problems like this
>throughout this program.
>
>
>-- 
>      //   David Tiberio  SUNY Stony Brook 2-3662  AMIGA  DDD-MEN   
>     //  Not the llama! Come here Earl; I want to tell you something...
>   \X/  Liverpool, New York	flames to suggestions@cbmvax.commodore.com

Try This:

Temp : String;

Begin
 Readln(Temp);
 If Temp <> '' Then Current := Temp;


When the user hits return and hasn't typed anything then there will be
no change made to the current string.  If the user did type something then
it is assumed that they wanted a change, which is done.

Hope this help

-MAtthew Crocker
s1949782@titan.ucc.umass.edu
Re: pascal trouble
#8
Author: Charles F Lane
Date: Mon, 13 Apr 1992 18:29
36 lines
2650 bytes
In article <1992Apr12.024103.27635@sbcs.sunysb.edu> dtiberio@csws7.ic.sunysb.edu (David Tiberio) writes:
>
>	I have to do a database option where the user presses
>RETURN if he does not want the data changed. The string read
>in is an array of length 9. This is what I tried:
>
>	if string = '         ' then data_does_not_change;
>
>	This line is not being read for some reason the way
>I would expect it to. Should this work? It could be that I forgot
>something somewhere else, but I have had problems like this
>throughout this program.
     Well fellow Stony Brooker, I think the above means if the user
presses the spacebar 9 times and presses return then data_does_not_change.
A better test would be to see if the length of the string is zero.  This
is done by checking string[0].  The 0th index of a string contains it's
length.  But I'm not sure if this value is always 9 since you said the
string has length 9 (declared in type declaration I'm assuming).  Another
way would be to save the string before return is pressed and do:
 if StringBeforeReturn = StringAfterReturn then data_does_not_change;
This is assuming readln leaves a string unchanged if only return is pressed.
To be sure, you can writeln the string to screen before return, press
just return, and writeln the string again.  See what happens.  If the string
is untouched you can use the last method I described.
Maybe someone who knows more about strings can verify/add to all this! :-)
But do experiment a little like suggested above.  You can find out a lot
if you peek at what's going on with variables before/after things happen...

>      //   David Tiberio  SUNY Stony Brook 2-3662  AMIGA  DDD-MEN   
>     //  Not the llama! Come here Earl; I want to tell you something...
>   \X/  Liverpool, New York	flames to suggestions@cbmvax.commodore.com

-- 
~~~~~~~ I'm (sine)waving goodbye!  | Bo knows football, basketball, baseball,
Charles F. Lane                    | hockey, diddley, etc.  But does he know
clane@Libws1.ic.sunysb.edu         | computers?!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads