Advertisement
ArtisOracle

Untitled

Sep 21st, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     int note1,note2;
  8.     double f,p;
  9.    
  10. while (true) {
  11.     printf("Please enter first MIDI note (0-127): ");
  12.     scanf("%d", &note1);
  13.     int valid = checkIfValid(note1);
  14.     if (valid == 1)
  15.         break;
  16.     else
  17.         printf("NO");
  18. }
  19.    
  20. while (true) {
  21.     printf("Please enter second MIDI note (0-127): ");
  22.     scanf("%d", &note2);
  23.     int valid = checkIfValid(note1);
  24.     if (valid == 1)
  25.         break;
  26.     else
  27.         printf("NO");
  28. }
  29.    
  30.     return 0;
  31. }
  32.  
  33. int checkIfValid(int note) {
  34.     if (note >= 0 && note <= 128)
  35.         return 1;
  36.     else
  37.         return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement