All right this is easy and for some reason im having trouble. Im workng on a Pig Latin program but right now all I want help with is getting an entire sentence to print out. I first tried to do this
char pig_latin()
{
char sentence[100];
printf("Enter a sentence\n");
scanf("%s", sentence);
printf("Sentence was: %s\n", sentence);
}
of course after reading past posts and thinking about it I realize that will only print the first word. So i found this in a post and tried it (and some other attempts using gets().
char Sentence[50];
printf("Enter String >");
gets(Sentence);
I also read that I should use fgets() instead of gets() and I understand why. The problem im having is how exactly to use it. Here is my last try but it doesnt allow the user to input a sentence. And I was told not to use scanf by some other people.
char sentence[80];
printf("Enter a sentence in all CAPS to be translated into piglatin:\n");
fgets(sentence, sizeof(sentence), stdin);
printf("Heres the sentence: %s\n", sentence);