Classwork 17: Character Substitution
Practice writing a function with a string parameter.
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% ./a.out Enter string: Hello World Mangled string: H@ll@ W@rld PT%
- 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.
SubmitUse 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