Print the sources to the following problems and turn them in, in the order listed below, at the beginning of class on the due date. Also place your solutions in your CVS repository as follows:
/homework/cmsi284/src/main/c/apps/piano_keys.c
/homework/cmsi284/src/main/c/apps/piano_scales.c
/homework/cmsi284/src/main/c/utils/max_string.c
/homework/cmsi284/src/main/c/utils/rotate_string.c
/homework/cmsi284/src/test/c/max_string_test.c
/homework/cmsi284/src/test/c/rotate_string_test.c
Make sure that you have run the setup-class script so that I can checkout and run your code from CVS while grading.
$ piano_keys A 27.5000 A# 29.1352 B 30.8677 C 32.7032 C# 34.6478 D 36.7081 D# 38.8909 . . . A# 3729.3101 B 3951.0664 C 4186.0090
$ piano_scales F# F# major: F# G# A# B C# D# F F# F# minor: F# G# A B C# D E F#
Write a C function that takes in a string s and an int k and returns a newly allocated string which is the k-fold left rotation of s. For example, perfoming this operation on "doghouse" and 3 will return "housedog". More examples:
rotate("doghouse", 0) ===> "doghouse"
rotate("doghouse", 1) ===> "oghoused"
rotate("doghouse", 2) ===> "ghousedo"
rotate("doghouse", 3) ===> "housedog"
rotate("doghouse", 4) ===> "ousedogh"
rotate("doghouse", 5) ===> "usedogho"