Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a C program that prompts the user to input a sentence that the program

ID: 3624649 • Letter: 1

Question

1. Write a C program that prompts the user to input a sentence that the program will
then convert to Pig Latin. This translation is performed by moving the first letter of
each word to the end of the word and appending the letters “ay”. For example, if
the user types the sentence, “His dog bit her cat.”, your program should print,
“isHay ogday itbay erhay atcay.”. You can assume that the end of each sentence is
identified with a period. Your program should be written using a function that
translates one individual word into Pig Latin. Your main function should then call
this translation function as many times as necessary to translate and print the entire
sentence.

I tried several ways... And I got it to work...However...I need to use the scanf() keyword to make the program terminate when a "." is entered.

Explanation / Answer

I'll give you pseudocode (This is assuming that yourfun, the function you wrote, does the conversion and prints it to screen.) : while(true) { char buff[256]; scanf("%s", buff); if(there is a period in buff) { remove period; yourfun(buff); print the period; break; } else { yourfun(buff); printf(" "); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote