fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void printPigLatin(char *word) {
  5. printf("%s%cay ", word + 1, word[0]);
  6. }
  7.  
  8. int main(void) {
  9. char phrase[100];
  10. printf("Enter a phrase: ");
  11. fgets(phrase, sizeof(phrase), stdin);
  12. phrase[strcspn(phrase, "\n")] = '\0'; // إزالة سطر الإدخال
  13.  
  14. char *token = strtok(phrase, " ");
  15. while (token != NULL) {
  16. printPigLatin(token);
  17. token = strtok(NULL, " ");
  18. }
  19. printf("\n");
  20. return 0;
  21. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Enter a phrase: