Zum drĂ¼berschauen

Hallo zusammen,

next time i will have my exames, now i wanna show you my binaer- hexa-calculator, to check it for me please.
It should be correct, easy to understand & short!

http://pastebin.de/15121

I am very thankful for each advice, if you think, that my code is correct, leave a "It's okay" or something

Greetz Shaddy

PS: To be true, im a bit nervouse

Edit: Sorry for german post..
Last edited on
English Please
Why do you use that ancient MFC? That'd be something for the console (or at least a newer gui like http://www.wxwidgets.org/ which is not perfect, but ok to use)

So I can't compile your code. But you can simplify the switches by using the bit oprands | >> << etc. You don't need pow()

To make '5' from 5 you could write: 5 + '0'. The other way: 5 from '5' would be '5' - '0'
Last edited on
Note that the only difference between dex2bin and dec2hex is the operand in the division and the modulus.
So you could make a general function, to represent a number in "any" base (with a symbol table)

Also the reverse of the string should be a function, in fact there is std::reverse in algorithm. (or you could use recursion)

To convert from the string, you could use Horner's method for polynomial evaluation http://en.wikipedia.org/wiki/Horner_scheme#Description_of_the_algorithm
Topic archived. No new replies allowed.