Advertisement
ArtisOracle

Untitled

Oct 8th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. * Takes in values for MIDI notes and checks to make sure
  3. * they are valid (between 0 and 127). It will ask the user again for valid numbers.
  4. * If valid, this will return the note entered.
  5. */
  6. int acceptAndValidateInput(unsigned int which)
  7. {
  8.     int note;
  9.     while (1)
  10.     {
  11.         printf("Please enter MIDI note #%u (0-127): ", which);
  12.         scanf("%d", &note);
  13.         if (note < 0 && note > 127)
  14.             printf("The value entered was invalid. Try again.\n");
  15.            
  16.         else
  17.             return note;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement