The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 408 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Implement Algorithm G.2 on page 403 to convert hexadecimal numerals to decimal:
int decimal(string s);
// Returns the decimal numeral that represents the hexadecimal
// numeral stored in the string s.
// PRECONDITION: s.length() > 0 and each s[i] is a hexadecimal
// digit
// POSTCONDITION: the returns value is the decimal equivalent
// EXAMPLE: decimal("2d7b") returns 11643
Note that this is the inverse of the hexadecimal() function in Problem 9.12. [Hint: Write an auxiliary function int v(string s, int i) that returns the decimal digit for the hexadecimal character s[i]; e.g. , v("2d7b", 3) returns 12.]
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on-----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------