Created
January 16, 2021 11:36
-
-
Save bebyx/dd8726484a58aa5bc7959f779f63397c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
char* latinize(char *word); | |
int main() { | |
char sentence[100]; | |
char *token, *word; | |
const char delimiter[2] = " "; | |
fgets(sentence, 100, stdin); | |
sentence[strcspn(sentence, "\n")] = 0; | |
token = strtok(sentence, delimiter); | |
while( token != NULL ) { | |
word = token; | |
printf("%s ", latinize(word)); | |
token = strtok(NULL, delimiter); | |
} | |
puts(""); | |
return 0; | |
} | |
char* latinize(char *word) { | |
static char latinized_word[50]; | |
char buffer[50]; | |
strcpy(buffer, &word[1]); | |
strncat(buffer, word, 1); | |
strcat(buffer, "ay"); | |
strcpy(latinized_word, buffer); | |
return latinized_word; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment