Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- ch1, ch2, ch3: char;
- int1, int2, int3: integer;
- begin
- write('Enter a random character: ');
- readln(ch1); {reading character}
- int1 := Ord(ch1); {character --> character's integer number}
- writeln('You entered character: ', ch1, '. Number of this character: ', int1);
- writeln('---------------');
- write('Enter a random number (0..255): ');
- readln(int2); {reading integer}
- ch2 := Chr(int2); {character's integer number --> character}
- writeln('You entered number: ', int2, '. The character on this number: ', ch2);
- writeln('---------------');
- write('Enter a random digit (0..9): ');
- readln(ch3); {reading digit as character}
- int3 := Ord(ch3) - Ord('0'); {converting char digit --> integer digit}
- writeln('You entered digit, char: ', ch3, ', integer: ', int3);
- writeln('---------------------------');
- writeln('Press any key...');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement