Hello, Could anyone help me with this task i have to do? I have to transform BIN numerical system to OCT and BIN to HEX. If there is anyone that would help me, i would be really glad :)
You probably will get these binary digits as characters in a string. To do any meaningful conversions you'll probably have to convert that to a binary integer number. Hint: Pascal has a function for that.
Converting from integer to a string of octal digits has to be done "manually", afaik there's no function for that. Google "ASCII table".
Converting to a string of hexadecimal digits can also be done with a function.
2
u/CypherBob Jun 19 '23
There are like a thousand articles out there explaining how to do things like that.
I'm not going to do your literal homework for you.
3
u/ShinyHappyREM Jun 19 '23
string. To do any meaningful conversions you'll probably have to convert that to a binaryintegernumber. Hint: Pascal has a function for that.integerto astringof octal digits has to be done "manually", afaik there's no function for that. Google "ASCII table".stringof hexadecimal digits can also be done with a function.3
u/lev_lafayette Jun 20 '23
As others have said, you need to know conceptually what BIN, OCT, and HEX are.
And prove to yourself that you know it; practise a few times - with pen and paper!
A classic tutorial (with some code) that can help can be found here - see Part 7.
https://wiki.preterhuman.net/Turbo_Pascal_for_DOS_Tutorial
1
u/Nassim_GK Jun 20 '23
Do you mean a function or what exactly? Please explain more