[Previous Homework]
[Next Homework]
You are going to implement a program to censor bad words. You will read in a file from which you will censor the bad words by replacing each letter in the bad word with X, and write the censored contents out to a new file.
From Linux on the GL machine:
Make sure that you follow all the coding standards
hw21 - File I/O 2
You are going to implement a program to censor bad words. You will read in a file from which you will censor the bad words by replacing each letter in the bad word with X, and write the censored contents out to a new file.
- Pass the words to be censored in as command line arguments and save them in an array of strings.
-
Do this in main()
Assign each of the bad words from the command line to your array of bad words.
Print out the bad words that you will be censoring.
There should be a maximum of 10 bad words that will be censored.
- Open the files for reading and writing.
-
Input file name is bleepIn.txt
Input file name is bleepOut.txt
- Write a function called censor() to process the text.
-
Send in the bad words, the number of bad words, and pointers to the two files as parameters.
- Read in the text one line at a time.
- For each bad word that occurs in the line, replace each letter in the bad word with X.
- Print out the censored line of text to the output file.
Close the files
- EXTRA CREDIT - 5 POINTS
-
Instead of replacing each char of the bad word with an X, replace the entire bad word with **BLEEP**
From Linux on the GL machine:
-
Compile the program:
gcc -o bleep bleep.c
Run the program to make sure it works:
./bleep
Use the SUBMIT utility turn in the homework.
submit cs104_grasso hw21 bleep.c bleep bleepIn.txt bleepOut.txt
Reference Programs :
Make sure that you follow all the coding standards