If != means 'not equal to' then that's exactly what I mean, but this version of Pascal doesn't seem to liek that, so I used <> instead. Also it needed a 'do' to go with the 'while'.
Unfortunately, all I end up with is a reccurring loop of:
Input a string consisting of the symbols a, b, c, d, and e: String Rejected :-(
Input a string consisting of the symbols a, b, c, d, and e: String Rejected :-(
Input a string consisting of the symbols a, b, c, d, and e: String Rejected :-(
ad infinitum.
I think that might be because of an earlier element in the 'readstring' process...
Code: ags
...which basically tells the program to give the user a chance to input the string before pressing 'enter'... but when we're telling it to go back to the beginning of the program, it's registering that 'enter' has now been pressed, so it is infinitely rejecting empty strings.
Perhaps I can solve this by putting (not eoln) as an initial state... but I don't know how to do that either.
Unfortunately, all I end up with is a reccurring loop of:
Input a string consisting of the symbols a, b, c, d, and e: String Rejected :-(
Input a string consisting of the symbols a, b, c, d, and e: String Rejected :-(
Input a string consisting of the symbols a, b, c, d, and e: String Rejected :-(
ad infinitum.
I think that might be because of an earlier element in the 'readstring' process...
{ *** ReadString Procedure *** }
procedure readstring (var string : stringtype;
var stringlength : integer);
var
i : integer;
begin
i := 1;
while (i <= 12) and (not eoln) do
begin
read (string [i]);
i := i + 1;
end;
stringlength := i - 1;
end;
...which basically tells the program to give the user a chance to input the string before pressing 'enter'... but when we're telling it to go back to the beginning of the program, it's registering that 'enter' has now been pressed, so it is infinitely rejecting empty strings.
Perhaps I can solve this by putting (not eoln) as an initial state... but I don't know how to do that either.
