while(getchar () != '\n')//so that the program doesn't take in the carriage return as input
continue;
printf ("Enter another character: ");
scanf ("%c", &char2);
while (getchar () != '\n')//so that the program doesn't take in the carriage return as input
continue;
And I'm just not sure how to verify if their HEX or just normal characters (so either 0-9 or A-F). I was thinking I could just do a bunch of if statements comparing each of them (or make a HEX array, and for loop through it comparing along the way), but is there a better way to do this?
while(getchar () != '\n')//so that the program doesn't take in the carriage return as input
continue;
printf ("Enter another character: ");
scanf ("%c", &char2);
while (getchar () != '\n')//so that the program doesn't take in the carriage return as input
continue;
And I'm just not sure how to verify if their HEX or just normal characters (so either 0-9 or A-F). I was thinking I could just do a bunch of if statements comparing each of them (or make a HEX array, and for loop through it comparing along the way), but is there a better way to do this?
C has a function called isxdigit which checks if the character is 0 -9 or a - f maybe you could use that...
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.