Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 18
- int charcount(char aInput[]){//returns the number of characters in the input
- int i = 0;
- while(i < MAX){
- if(aInput[i] == 0)
- return i;
- i++;
- }
- }
- void j3j3m0n(char aInput[], int nLetter){//this function translates normal words into j3j3m0n w0rDes
- int i = 0;
- while(i < nLetter){
- {
- if (aInput[i] == 'o' || aInput[i] == 'O')//changes 'o' or 'O' to '0'(zero)
- aInput[i] = '0';
- if (aInput[i] == 'e' || aInput[i] == 'E')//changes 'e' or 'E' to '3'
- aInput[i] = '3';
- }
- i++;
- }
- if (aInput[i - 1] == '0'){//if the last character is '0'(zero), adds 'w' and 'z' at the end
- aInput[i] = 'w';
- aInput[i + 1] = 'z';
- nLetter += 2;
- }
- i = nLetter;
- if (aInput[0] == 's'){//if the first and/or letter is 's', replaces 's' with 'e' and 's'
- while (i > 0){
- aInput[i] = aInput[i - 1];
- i++;
- }
- aInput[0] = 'e';
- }
- i = 0;
- while (i < nLetter){//makes the output alternate from lower case to upper case via ASCII, respectively
- if((i % 2) == 1 && aInput[i] >= 97 && aInput[i] <= 122)
- aInput[i] -= 32;
- else if ((i % 2) == 0 && aInput[i] >= 65 && aInput[i] <= 90)
- aInput[i] += 32;
- i++;
- }
- }
- int main(){
- char aInput[MAX];
- int nLetter;
- printf("Enter a word: ");//asks user for input
- scanf("%15s", aInput);
- nLetter = charcount(aInput);//counts how many letters are in the word (15 character limit)
- j3j3m0n(aInput, nLetter);//calls the function to translate the word to j3j3m0n
- printf("j3j3m0n r3sUlT: %s", aInput);//displays j3j3m0n translation
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement