Guess The Color - Game Using C Programming Language










"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.  


For more source code and tutorial, SUBSCRBE to my YouTube channel.
 

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 :

  1. Conio
  2. Dos
  3. Graphics
  4. Stdio
  5. Stdlib

 

Library functions

The following library functions has been used

  1. Under conio header file
    1. Getch
    2. Clrscr
  2. Under dos header file
    1. Delay
    2. Nosound
    3. Sound
  3. Under graphics header file
    1. Closegraph
    2. Floodfill
    3. Initgraph
    4. Line
    5. Outtextxy
    6. Rectangle
    7. Setcolor
    8. Setfillstyle
  4. Under stdio header file
    1. Exit

 

Concepts used

Topics/ concepts of this language that you need to know for making this type of game :

  1. For looping statement
  2. File handling
  3. Graphics
  4. If else conditional statement
  5. 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

Article Ad1