-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix prompt range types causing comparison issues Fix linking in CMakeLists.txt
- Loading branch information
1 parent
969eedd
commit 0f344f3
Showing
3 changed files
with
49 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,33 @@ | ||
int main() {} | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <time.h> | ||
#include <stdbool.h> | ||
#include <amadeus/prompt.h> | ||
|
||
int main() { | ||
printf("The A.M.a.D.E.U.S. Project\n"); | ||
printf("Created by Noah Friedman\n"); | ||
|
||
// Get the maximum limit for the random number from the user | ||
int max = prompt_min("Enter a maximum", 1); | ||
|
||
// Initialize random number generator and generate the number the user will guess | ||
srand(time(NULL)); | ||
int number = rand() % max + 1; | ||
|
||
// Main loop | ||
while (true) { | ||
// Get the user's guess | ||
int guess = prompt_range("Enter a guess", 1, max); | ||
|
||
// Check if the guess is correct | ||
if (guess == number) { | ||
printf("Correct!\n"); | ||
break; | ||
} else if (guess < number) { | ||
printf("Higher!\n"); | ||
} else { | ||
printf("Lower!\n"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters