Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi console application schließt einfach... (https://www.delphipraxis.net/24503-console-application-schliesst-einfach.html)

dummer_info_schüler 22. Jun 2004 10:32


console application schließt einfach...
 
Hi @all!
Nachdem ich mich das letzte mal beschwert hatte, dass etwas nicht schließt, habe ich heute das gegenteilige problem :shock:

Ich habe eine Konsolenanwendung, die so aussieht:

Delphi-Quellcode:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var a,b,flaeche: integer;
begin
  readln(a);
  readln(b);
  flaeche:=a*b;
  writeln(flaeche);
end.
Wenn ich die starte, habe ich maximal ´ne Sekunde Zeit um die Fläche zu lesen, dann schließt das Fenster :wiejetzt:
Wie kann ich das verhindern? (meine *intelligente* Idee sieht ja so aus, noch ein <readln(a)> einfach hinten anzuhängen)
Also, her mit euren Ideen...
DUMMER_info_schüler

sakura 22. Jun 2004 10:35

Re: console application schließt einfach...
 
Einfach noch einen Prompt einfügen:

Code:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var a,b,flaeche: integer;
 [color=#ff0000]S: String;[/color]
begin
  readln(a);
  readln(b);
  flaeche:=a*b;
  writeln(flaeche);
  [color=#ff0000]ReadLn(S);[/color]
end.
...:cat:...

Stevie 22. Jun 2004 10:38

Re: console application schließt einfach...
 
@Sakura: Warum nicht einfach so?
Delphi-Quellcode:
program Project2;

{$APPTYPE CONSOLE} 

uses
  SysUtils;
var a,b,flaeche: integer;
begin
  readln(a);
  readln(b);
  flaeche:=a*b;
  writeln(flaeche);
  ReadLn;
end.

sakura 22. Jun 2004 10:42

Re: console application schließt einfach...
 
Zitat:

Zitat von Stevie
@Sakura: Warum nicht einfach so?

Zu einfach :roll: :oops:

...:cat:...


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz