Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "Lock.h"
  3. #include "Speaker.h"
  4.  
  5. int main(void) {
  6. int lock = LOCK_GenerateLock(); /* generate a new lock of type 'unsigned int' (32bit) */
  7.  
  8. int correctBits;
  9. int key = -1;
  10.  
  11. for( unsigned int i = 0; i <= 99999U; ++i )
  12. {
  13. correctBits = LOCK_Test( i );
  14.  
  15. if( correctBits == 32 )
  16. key = i;
  17. }
  18.  
  19. //n = LOCK_Test(5); /* check number of correct bits */
  20. //SPEAKER_Play(1000,200); /* play 1000 Hz for 200 ms */
  21.  
  22. if( key != -1 )
  23. printf( "Error couldn't find the key.\n" );
  24. else
  25. printf( "The correct key is %d\n", key );
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement