Posted by Lionel p12219 on August 30, 2003:
In an earlier post (June 25, 2003) you mentioned that I might want to develop a Delphi "console" application,
that outputs to a DOS-Box. I am now trying to work my way through the same problem except
this time I using the "Console Mode" ----- I know how to set up the application in the
console mode but have not found out how to put the output to a DOS-Box like you mentioned
earlier. I would appreciate a simple example using the following code: Program pause01; {$APPTYPE CONSOLE} uses SysUtils, Windows, Math; //*********************************** Procedure Pause; var message :string[80]; response:char; readkey, P: char; begin message := 'press any key to continue'; write(message); response := readkey; if (response = P) then halt; writeln; end; //***********End Procedure*********** Var N1, N2 : Real; D, X : real; Begin WriteLn('Hello World'); pause; WriteLn('Hello Again'); readln; WriteLn('You got it'); //******************************************* WriteLn; WriteLn; WriteLn('Enter a Number'); Readln (N1); WriteLn; WriteLn; WriteLn('Enter another Number'); ReadLn(N2); WriteLn; WriteLn('First Number X Second Number= ',N1*N2:8:4); WriteLn; WriteLn; WriteLn; Pause(); //------------------- ReadLn; //------------------ WriteLn('Ehis is Good Bye for now'); //------------------------------------ WriteLn; WriteLn; WriteLn('Enter an Angle D '); ReadLn(D); X := D*Pi/180;//convert angle to radians WriteLn; WriteLn; WriteLn(' The Sin of this Angle is = ',sin(X):5:6); WriteLn('The Cos of the Angle = ',Cos(X):8:8); WriteLn; WriteLn; Pause(); //---------------------------------------------- ReadLn; // Pause? //--------------------------------------------- end. Note: The results of the math shows up on the screen but how would one print out the results? In this case for example how would print out the Sin and Cos of the Angle D?
[ DelphiLand: free Delphi source code, tips, tutorials ] |
Compiling Console Applications Learn Pascal with simple Delphi Console Applications |