#include <stdio.h>
#include <stdlib.h>

void main(void)
{
	char go_on = 'y', newline;
	char string[16]; 
	
	/* Here's a basic while loop reading a character.  go_on is set to
y so we 
	   are sure to get at least one trip throught the loop */
	while ((go_on == 'y') || (go_on == 'Y')) {
		printf("Hello there.\n");
		printf("Would you like to see the message again (y/Y or
n/N)? ");
		
		/* By using two format specifiers and two variables I can
read the 
		   newline separately, which cleans this up quite a bit.
*/
		scanf("%c%c", &go_on, &newline);
		printf("go_on: %c newline: %c\n", go_on, newline);
	}

	go_on = 'y'; 

	/* Same loop, etc. only now we are reading in a string */
	while ((go_on == 'y') || (go_on == 'Y')) {
		printf("Enter the string you would like to print: ");
		fgets(string, sizeof(string), stdin);
		printf("You entered: %s\n", string);
		
		printf("Would you like to print another string (y/Y or
n/N)? ");
		scanf("%c%c", &go_on, &newline);
		printf("\ngo_on: %c newline: %c\n", go_on, newline);
		
	}

	return;
}


