Number Guessing Game Project with C Programming and Flowgorithm
เขียนโปรแกรมทายตัวเลข
1. Number Guessing Game Project Source Code on C Programming with Dev C++ IDE
Name Guessing Game Source Code
#include <stdio.h>
int main() {
srand(time(0)); //Seed random number generator
int secret, guess;
guess = 0;
secret = rand() % 100 + 1; //(0-99)+1 --> 1 - 100;
//secret = 50+(rand() % (201-50)); --> 50 - 200
printf("Guess Number 1 to 100\n");
while (guess != secret) {
scanf("%d", &guess);
if (guess == secret) {
printf("Your guess = %d is Correct!\n", guess);
}
else if (guess > secret)
{
printf("Your guess = %d is too High\n", guess);
}
else
{
printf("Your guess = %d is too Low\n", guess);
}
}
printf("You're the Winner!\n");
printf("Thanks for playing!\n");
return 0;
}
Output
2. Name Guessing Game Project with Flowgorithm
Download Flowgorithm Software –> http://www.flowgorithm.org/download/index.html
Open Flowgorithm –> Creating Name Guessing Game
3. Set Code & Console View and Show Variable Watch
4. Test Number Guessing Game
5. Converting Source Code 28 Programming Languages on Flowgorithm
6. Number Guessing Game with Python Programming
7. Number Guessing Game with C++ Programming
8. Number Guessing Game with Java Programming
9. Number Guessing Game with JavaScript Programming
10. Number Guessing Game with MATLAB Programming