Supposing we have the following function (c language) that puts a REAL number in a table called input:
int getop(char input)
-how can i transform the above function so that it can only read integers?
-how can i transform the same function so that it can only read numbers in the hex-form (i mean that the base should be 16,for example B65F is the 46687 in the hex system
-could you help me in order to make some kind of a ishex() function that will check if the number given is given in a hex form?(just like the isdigit function, that checks out if the number given is a digit!
any help would be really helpful for me.thanks in advance!
Normally real numbers could apear like 3.567e-10 which lets you have very small and very large numbers. However in your case, it is a simplified version and so it can be easily used for integer. You only need to use the first part which reads the integer part of the real number. Delete the part that manipulates the fraction part (afte '.').
Working with hex numbers is very similar tio integer numbers. You only need to be able to detact the alphabetic digits (see below).
The is a function already implemented for this purpose. It is called isxdigit() and is in ctype.h. See the following microsoft link for more details: