"1337 sp3@k", or "leet speak", is an online trend in which people replace letters with numbers or symbols as they type, to show how cool they are. If a word doesn't have any numbers in it, it is considered normal; but if it does have any numbers in it, then it is considered 1337! Sometimes it is difficult to understand a sentence when it is written in 1337... We need a way to convert words back and forth between "1337" and "normal" speak! Write a program that lets the user enter a word that is 15 characters or less. Tell the user if the word is 1337 or if it is normal, using the rules below. Then, if the word was originally normal, convert it to 1337; if it was originally 1337 , convert it to normal. Finally, print out the converted word. Assume a word is "1337" if at least 1 character in the word is "1337"; i.e., the word "le3t" is still considered "1337". When converting to 1337, convert both lower and upper case letters. When converting to normal, simply write a lower-case character. Only check for the below numbers when determining if the word is 1337. You must implement the ConvertEntireWord function to receive full credit; the string must be manipulated in the function to receive full credit - do not make a copy.
main.c Load default template... \#include \#include void ConvertEntireWord(char string [] ); int main(void) \{ char string[15]; printf("Please enter a word. \n" ); scanf("\%s", string); ConvertEntireWord(string); return 0 ; \} void ConvertEntireWord(char string [] ) \{ int flag=0; //iterate each character and check string is '1337' or not for (int i=0; string [i]!=?\??;i++){ if (string [i]=?1 ') \{ string [i]= ' l '; flag =1 \} else if (string [i]=?3?){ string [i]= 'e'; flag =1; \} else if (string [i]==?7?){ string [i]= ' t '; flag =1 \} \} //if flag is 1 that means string is 1337 else normal if(flag ==1){ printf("The word is 1337\ nConverted Word: \%s", string); \} else \{ //iterate each character and check string is 'normal' or not for(int i=0; string i]!= ' \0?;i++){ if (string [i]= ' ? ' || string [i]= ' a ') string [i]=? '; else if (string [i]== 'B' || string [i]== ' b ') string [i]=?8? ' else if (string [i]== 'E' || string [i]==e? ') string [i]= ' 3 '; else if (string [i]= ' L ' || string [i]== ' l ') string [i]=11 '; else if (string[i] = ' T ' || string [i]== ' t ') string [i]= '7'; \} printf("The word is normal \ nConverted Word: \%s", string);
Input \begin{tabular}{l|l} \multirow{3}{*}{ Your output } & Please enter a word. \\ The word is normal \\ Converted Word: R4c3c4r \end{tabular} Compare output ? 5/5 Input \begin{tabular}{|l|l|} \hline Your output & Please enter a word. \\ The word is 1337 \\ Converted Word: elite \end{tabular} Unit test ? 10/10 Test the ConvertEntireWord function Your output Testing the function with the word "macaroni" Your function generated: m4c4roni. This is correct! Unit test ? Test the ConvertEntireWord function Your output