"Guess The Color" is my first ever game in programming sector for which I have used computer programming language. In this game, the player is asked to guess the number between 0 and 15. The program generates random number between 0 and 15. If the guessed number and the number generated by the program matches, point is provided to the user and asks the user for another guess. The detail of highest score is stored in a file.
How to download the source code?
- Click here for source code.
- New window will open where there is a source code of this project. Download that file.
- Remember to run this code in Turbo C++.
Demo of the project
Check out the following video for the demo of this project.
Development platform
Computer programming language has been used to develop this project.
Compiler
Turbo C has been used as compiler. The compiler version for Turbo C++ that has been used is 3.7.8.9.
Header files used
The header files used in this project are as follows :
- Conio
- Dos
- Graphics
- Stdio
- Stdlib
Library functions
The following library functions has been used
- Under conio header file
- Getch
- Clrscr
- Under dos header file
- Delay
- Nosound
- Sound
- Under graphics header file
- Closegraph
- Floodfill
- Initgraph
- Line
- Outtextxy
- Rectangle
- Setcolor
- Setfillstyle
- Under stdio header file
- Exit
Concepts used
Topics/ concepts of this language that you need to know for making this type of game :
- For looping statement
- File handling
- Graphics
- If else conditional statement
- While looping statement
Logic description
The main task in this project is to generate random number and compare that number with the number given by the the user. For generating random number, "rand" function has been used. And for comparing the numbers, if else conditional statement has been used.
For more interaction with the user, specific sounds for wrong ad right guess has been integrated.
While saving the new score in a file, first of all, score saved in a file is compare with the new one. In case new score is greater than previous highest score, new score is saved in a file.
Even if this project is small, it can be very helpful for the beginners as it has integrated the concept of both the file handling and graphics.
No comments:
Post a Comment