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?

Recommended Answers

All 3 Replies

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.

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.

Maybe, I forget to put the 'dot' after the end.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.