|
1. (Occurences of a specified character) Write a function that finds the number of occurrences of a specified character in the string using the following header:
Int count(const char * const str, char a)
For example, count(“Welcome”, ‘e’) returns 2.
prompt the user to enter a string and a letter
2. (Hex to decimal) Writer a function that parses a hex number as a string into a decimal integer. The function header is as follows:
Int parseHex(const char * const hexString)
For example, hexString A5 is 165 (10x16+5=165) and FAA is 4100 (15x16^2+10x16+10=4100). So, parseHex (“A5”) returns 165 and parseHex(“FAA”) returns 4100. Use hex strings ABC and 10A to test the function.
prompt the user to enter a hexadecimal number
3. (Sorting characters in a string) Write two overloaded functions that return a sorted string using the following header:
Char * sort(char *s)
Void sort(const char * const s, char * s1)
For example, sort(“acb”) return abc.
you will have to allocate memory for the sorted array |
|