OODP Week 2 Exercises
OODP Week 2 Exercises
14.Create your own version of the library function strcmp(s1, s2), which compares
two strings and returns –1 if s1 comes first alphabetically, 0 if s1 and s2 are the same,
and 1 if s2 comes first alphabetically. Name your function compstr(). It should take
two char* strings as arguments, compare them character by character, and return an
int. Write a main () program to test the function with different combinations of
strings. Use pointer notation throughout.
15. Write a complete program that prompts the user for the radius of a sphere, and
calculates and prints the volume of that sphere. Use an inline function
sphereVolume that returns the result of the following expression: (4.0 / 3.0 *
3.14159 * pow(radius, 3)).
Structures, Union, and File concepts in C prepared by Dr.S.Suchithra . DSBS