SELF TEST
Determine the output of the following program
program function_time (input, output);
const maxsize = 80;
type line = packed array[1..maxsize] of char;
function COUNTLETTERS ( words : line) : integer; {returns an integer}
var loop_count : integer; {local variable}
begin
loop_count := 1;
while (words[loop_count] <> '.') and (loop_count <= maxsize) do
loop_count := loop_count + 1;
COUNTLETTERS := loop_count - 1
end;
var oneline : line;
letters : integer;
begin
writeln('Please enter in a sentence terminated with a .');
readln( oneline );
letters := COUNTLETTERS( oneline );
writeln('There are ',letters,' letters in that sentence.')
end.
Please enter in a sentence terminated with a .
Hello there.
There are 11 letters in that sentence.
Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.