Classwork 17: Character Substitution
Objectives
Practice writing a function with a string parameter.
The Assignment
Write a program that takes a string entered by the user and replaces each occurence of a vowel with the @ symbol.
Use vowel.c as the starting point of the program. The main function is already provided and will read in the input from the user. Your assignment is to implement the function at_vowel.
The function at_vowel() has a single string parameter str. The at_vowel() function must replace each occurence of a vowel with the @ symbol.
A sample run of your program might look like:
PT[106]% ./a.out Enter string: Hello World Mangled string: H@ll@ W@rld PT[107]%
Notes
- The program assumes that the user will not enter a string longer than 255 characters long.
- We will assume that the only vowels are 'a', 'e', 'i', 'o' and 'u'. That is, we consider 'y' to be always a consonant.
Submit
Use the script command to record several sample runs of your program. Then, submit your program and sample run as usual:submit cs104_chang cw17 vowel.c typescript