Skip to content

Instantly share code, notes, and snippets.

@captain-woof
Created January 28, 2021 19:17
Show Gist options
  • Select an option

  • Save captain-woof/811d836bb82c61398f9422f86a2447ab to your computer and use it in GitHub Desktop.

Select an option

Save captain-woof/811d836bb82c61398f9422f86a2447ab to your computer and use it in GitHub Desktop.
main(){
unsigned int random;
int answer;
/* CODE TO PRINT BANNER */
/* Seeding rand() with the current unix time below */
time_t seed = time(0);
srand(seed);
/* Loop that checks for correctness of user's guesses */
for(int i=1; i<=30; i++){
/* CODE TO PRINT PROMPT */
random = rand() & 15;
/* CODE TO PRINT PROMPT */
scanf("some prompt here: %d",&answer);
if(answer == random){
continue;
}else{
/* CODE TO PRINT EXIT MSG */
exit();
}
}
/* CODE FOR SUCCESS MESSAGE TO BE PRINTED */
get_flag();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment