Help to deal with the problem in Delphi XE, which arose with the first program. Code:

program Helloworld; //название программы {$APPTYPE CONSOLE} //директива компилятору о создании консольного приложения begin writeln('Hello, world!'); //вывод сообщения Hello, world! end. //конец программы 

After compilation, the text box appears momentarily and disappears. What could be the problem and how to fix it?

  • it is necessary readln; at the end of the program - sudo97

3 answers 3

There's no problem. The program starts, displays 'Hello, world!' and quietly ends, that is, does exactly what they wanted from it.


If you want the program to hang 3 seconds before closing, for example, correct this option:

 program Helloworld; //название программы {$APPTYPE CONSOLE} //директива компилятору о создании консольного приложения uses sysutils; begin writeln('Hello, world!'); //вывод сообщения Hello, world! sleep(3000); end. //конец программы 

    Simply write ReadLn before the last end - then the program will wait for the Enter key to be pressed.

      Try to install Readkey; at the end of the program Readkey;

      • 3
        For the function ReadKey, you need the Crt module, it is not in Delphi, but you can find it on the Internet. But I only came across a Crt in which the ReadKey and KeyPressed functions do not work. - DelphiM0ZG