This is a small program that helps beginners understand ASCII codes, character-type and integer types.
For example, enter I love you
Print 73 32 108 111 118 101 32 121 111 117 13 10
Program transpro (input, output );
VaR
Judge, Number: integer;
Letter: Char;
Begin
Writeln ('this software was produced by chaobs! ');
Writeln ('you can use this soft ');
Writeln ('to translate numbers into letters or to translate to nuambers! ');
Writeln ('Press 1 to transplate numbers and 2 to transplate letters ');
Read (judge );
If Judge = 1
Then
Begin
Repeat
Read (number );
Letter: = CHR (number );
Write (letter );
Until number = 33;
Readln;
End;
If Judge = 2
Then
Begin
Repeat
Read (letter );
Number: = ord (letter );
Write (number ,'');
Until letter = '! ';
Readln;
End;
Writeln ('If you foud something wrong with my program please call chaobs! ');
Readln;
End.
The improvement of this program can be changed to the Caesar encryption method or the stream encryption method. I have used this method to implement a stream encryption program. Please refer to the Delphi/Lazarus section.