/* Peter Cline June 18
   Sentinel Loop testing
*/

#include <stdio.h>
#define SENTINEL -1

int main()
{
  int input;
  int max;
  
  printf("Enter a number, or -1 to quit: ");
  scanf("%d", &input);

  max = input;

  while ( input != SENTINEL )
  {
    // keep track of the largest number entered so far
    // test whether each new number is the largest
    if ( input > max ) {
      max = input;
      printf("There's a new maximum: %d\n", max);
    }    

    // scanf to get new user input
    printf("Enter a number, or -1 to quit: ");
    scanf("%d", &input);
  }

  printf("The final max is: %d\n", max);

  return 0;
}
