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

The prototypical Internet newbie is a fellow named B1FF, who has a unique way of

ID: 3640003 • Letter: T

Question

The prototypical Internet newbie is a fellow named B1FF, who has a unique way of writing messages. Here’s a typical B1FF communique:

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

Enter message: Hey dude, C is really 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

#include<stdio.h>
#include<ctype.h>
#include<string.h>
void main()
{
    char a[300];
    int i;
    gets(a);
    strcat(a,"!!!!!!!!!!");
    for(i=0;a[i]!='';i++)
    {

        a[i]=toupper(a[i]);
        if(tolower(a[i])=='a')a[i]='4';
        else if(tolower(a[i])=='b')a[i]='8';
        else if(tolower(a[i])=='e')a[i]='3';
        else if(tolower(a[i])=='i')a[i]='1';
        else if(tolower(a[i])=='o')a[i]='0';
        else if(tolower(a[i])=='S')a[i]='5';
    }
    printf("%s",a);

}

Here strcat() has been used to append or conactenate the "!!"....

toupper() converts the string to upper case.

.....:)..