/* tempMenu.c   Convert between celsius and fahrenheit with menu driven program */
/* P.Conrad for CISC105, Fall 2005 */

/* @@@ two functions are missing... you will get
   a link error */

#include <stdio.h>

/* function prototypes */

char readOneChar(void);
void doCelsiusToFarenheit (void);
void doFarenheitToCelsius(void);

/* print menu */

void printMenu(void)
{
  
  /* note string concatentation in next printf */
  
  printf("Please select a choice: \n"
         "F for Farenheit to Celsius \n"
         "C for Celsius to Farenheit \n"
         "Q to Quit \n"
         "Enter choice: ");
  return;
}

int main(void)
{
  char option;
  printMenu();
  option=readOneChar();
  while(option != 'Q')
    {
      switch(option)
	{
	case 'F':
	  doFarenheitToCelsius();
	  break;
	  
	case 'C':
	  doCelsiusToFarenheit();
	  break;
	  
	default:
	  printf("Sorry wrong choice. \n");
	}
      printMenu();
      option=readOneChar();
    }
  printf("Bye bye \n");
}


char readOneChar(void)
{
  /* read only one character from standard input */
  char myChar;
  fflush(stdin);
  scanf("%c",&myChar);
  return myChar;
}



