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: 3640030 • 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:

Sample:

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<string.h>

void main()

{

char message[50];

char B1FF[60] = "";

int i = 0;

clrscr();

printf("Enter the message: ");

gets(message);

for(i = 0; i < strlen(message); i++) //strlen() finds the length of the string

{

if(message[i] >= 'a' && message[i] <= 'z')

{

B1FF[i] = message[i] - 32; //converts the entire message into capital and makes it B1FF

}

if(B1FF[i] == 'A') //checking if B1FF array has a letter A

{

B1FF[i] = '4';   

}

else if(B1FF[i] == 'E')   //checking if B1FF array has a letter E

{

B1FF[i] = '3';

}

else if(B1FF[i] == 'B') //checking if B1FF array has a letter B

{

B1FF[i] = '8';

}

else if(B1FF[i] == 'I') //checking if B1FF array has a letter I

{

B1FF[i] = '1';

}

else if(B1FF[i] == 'O') //checking if B1FF array has a letter O

{

B1FF[i] = '0';

}

else if(B1FF[i] == 'S')

{

B1FF[i] = '5';

}

else

B1FF[i] = message[i];

//if any letter in message is capital, it is directly stored in B1FF

}

for(i = strlen(message); i <= strlen(message) + 8; i++) //appends 8 exclamation marks

{

B1FF[i] = '!';

}

printf(" The B1FF message is: %s", B1FF);

getch();

}

----------------------------------------------------------------------------------

This program works correctly.

Hope this helps!!!

All The Best!!!

Please do rate me!!!

Thanks!!!