ask

//Ask the user a yes/no question
bool ask(char question[]) {

 bool answer = true;

 //Ask the question on screen
 LCD.WriteRC(question, 3, 0);
 LCD.WriteAt("Yes", 70, 130);
 LCD.WriteAt("No", 190, 130);

 float x, y;

 //Wait until the user presses the screen
 while(!LCD.Touch(&x,&y));

 //Take user input, false = no
 if(x > 130) {
     answer = false;
 }
 Sleep(100);

 LCD.Clear( FEHLCD::Black );

 return answer;
}

Algorithm for ask:

  1. Set the answer to true.
  2. Write the question on the screen, and an option for yes or no.
  3. Wait until user touches the screen.
  4. If the user selects no, set answer equal to false.
  5. Return answer.
  6. End function.