0

Dear Sir,

It is a simple example using a string.

program dowhile;
{$APPTYPE CONSOLE}

uses SysUtils, OurCrt;
var
   my_words : string;

begin
     my_words := '';
     writeln('Enter some words (type "stop" to finish):');
     readln(my_words);

     while (my_words <> 'stop') do
     begin
          clrscr;
          Writeln('You typed:');
          writeln(my_words);
          writeln;
          writeln('Enter some words (type "stop" to finish):');
          readln(my_words);
     end;

     writeln;
     writeln('This program has finished now');
end

But it does not work. Could you tell me what's wrong of it?

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by turbomen
0

I don't know where is the problem,this program working well
put a dot to the end of the main program,and stop the program with rhe ReadLn; command

writeln;
writeln('This program has finished now');
ReadLn;
end.

1

While compiling I got an error on ourCrt.
Try this:

program dowhile;
{$APPTYPE CONSOLE}

uses SysUtils, Crt;
var
   my_words : string;

begin
     my_words := '';
     writeln('Enter some words (type "stop" to finish):');
     readln(my_words);

     while (my_words <> 'stop') do
     begin
          ClrScr;
          Writeln('You typed:');
          writeln(my_words);
          writeln;
          writeln('Enter some words (type "stop" to finish):');
          readln(my_words);
     end;

     writeln;
     writeln('This program has finished now');
end.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.