Friday, July 31, 2009

How to write a program in C by turning a hexadecimal to a decimal?

write a c program that utilizes strings and numeric conversions





1. Read strings using a function you write called getStr ().


2. Write a function named hextodecimal () that takes in (only) a string parameter representing a positive hexadecimal number and return its decimal equivalent (integer). This function returns -1 if the string provided connotes to a negative number and/or is comprised of invalid characters.


-note: you may not use any library functions in this function- you must write all code necessary to enact the coversion and return the appropriate result.


-this function must accept both upper and lower case versions of the hex character.


-You may want to write an additional function that vets any string for invalid hex character


3. If original string is invalid, output an unambiguous message to the user and prompt for another input.


4. Output the original String, followed by its decimal equivalent. Clearly label which





with ASCII of ‘0’=48; value of ‘A’=65

How to write a program in C by turning a hexadecimal to a decimal?
suggest you post a code sample of what you have done already. this way people can help you and not GIVE you the answer.


No comments:

Post a Comment