Board index » delphi » Using Hex/ASCII in tp7

Using Hex/ASCII in tp7

    I need some answers for a few things, i am an amateur.

Firstly, how do i insert a hex code of FDh (DEC: 253) into my Pascal
Programs? It is the super-script '2.'

Second, I need to insert an equation into pascal. e.g. y=4x+2
I want to enter this as a packed array, but cant seem to get the correct
method. I have declared it as: packed array [1..10] of char.
But then i am not sure on how to manipulate it, to access different
characters, Would i use a record instead?

Can someone help??

thanks.

--
-Daniel Yazbek
dyaz...@mbox.com.au

 

Re:Using Hex/ASCII in tp7


Hi,

on Mon, 07 Feb 2000 at 09:48:44 o'clock, Daniel Yazbek wrote:

Quote
> Firstly, how do i insert a hex code of FDh (DEC: 253) into my Pascal
> Programs? It is the super-script '2.'

$FD or 253, of course. As a character: Chr($FD) or #$FD.

Quote
> Second, I need to insert an equation into pascal. e.g. y=4x+2
> I want to enter this as a packed array, but cant seem to get the correct
> method. I have declared it as: packed array [1..10] of char.

Another possibility would be to use a string:

   var s : String;
   begin
      s := 'y=4x+2';
      Writeln(s);
      Readln(s);
      Writeln(s);
   end;

... try it :-)

Quote
> But then i am not sure on how to manipulate it, to access different
> characters,

As always with arrays:

   var a : packed array[1..10] of Char;
   begin
      a[1] := 'y';
      { But also: }
      a := '1234567890';
   end;

Strings are arrays of char, too, but they also have a length byte.
If you don't specify otherwise, they have length 255. Shorter strings
can be defined as follows:

   var s : String[80];

Note that you can nevertheless assign shorter literals (e. g. '123'
even if the string is longer than 3 characters). Use Length(s) to
determine the current length of the string (as opposed to the
capacity).

Quote
> Would i use a record instead?

I don't think so.

 - Sebastian

Other Threads