Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a “B1FF filter” that reads a message entered by the user and translate it

ID: 1797580 • Letter: W

Question


Write a “B1FF filter” that reads a message entered by the user and translate it into B1FF-speak:
Enter message: Hey dude, C is rilly cool
In B1FF-speak: H3Y DUD3, C 15 R1LLY COOL!!!!!!!!!!
Your program should convert the message to upper-case letters, substitute digits for certain letters (A->4, B->8, E->3, I->1, O->0, S->5), and then append 10 or so exclamation marks. Hint: Store the original message in an array of characters, then go back through the array, translating and printing characters one by one.

Explanation / Answer

There are 3 steps to this algorithm: 1. Input data 2. Substitutions 3. Output data After prompting the user, store the characters one at a time into a one-dimensional array, using getchar() function. Then, using a switch statement or if-else statements, iterate through each char and make the substitutions (A->4, B->8, E->3, I->1, O->0, S->5). These first two steps can be combined into one loop, however. here is how I coded steps 1 and 2: char msg[50], ch; int i = 0; printf ("Enter a message: "); while ((ch = getchar()) != ' ') { if (ch == 'a') msg[i] = '4'; else if (ch == 'b') msg[i] = '8'; else if (ch == 'e') msg[i] = '3'; else if (ch == 'i') msg[i] = '1'; else if (ch == 'o') msg[i] = '0'; else if (ch == 's') msg[i] = '5'; else if (ch >= 'a' && ch
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote