+ 5
how can I create my own data type which can take only hexadecimal in input??
I wanted to know if it's possible and if it's possible then how can I do it...??
4 Antworten
+ 6
* Create a class
* Take a string in constructors parameters
* If the string is not in hex, throw an exception
http://forums.codeguru.com/showthread.php?470704-Is-there-a-function-that-tell-you-whether-a-string-is-HEX-number
+ 4
Using a custom class, this is possible.
You will have to overload the >> operator to read a string (since FF is also a Number), and then convert it into a number for storage using stol or a similar function...
+ 4
@ Kinshuk Vasisht..
Can u write the code needed..
+ 2
https://code.sololearn.com/c2SGMjkCimz2/?ref=app
Try if this is what you wanted. Ill change if it didn't work for you..