C-Style String Homework

  1. Write a program that reads a string from the keyboard and prints out the string one word per line. Make your string large enough to hold 80 characters.
  2. Write a function that takes two string parms. The function should make the second string contain the reverse of the first string. For example, if the first second string contains "yes i can", then the function should set the first string to contain "nac i sey".
  3. Write a function Equal to test whether two strings are equal. Equal should return 1 if the two string parms contain the same chars, and return 0 otherwise.
  4. Write a function that has two parms: a string and a char. The function should return the subscript of the first occurrence of the char, or a –1 if the char is not in the string. For example, if the string is "yes i can" and the char is 'c', the function should return 6.
  5. Write a function trimfront that removes all leading blanks from the string passed to it.

Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2003