C++ program to guess the number-mini project in c++

The source code of the program to guess your name is right here. Type this code in codeblocks and enjoy the game. Computer will ask you to guess a number and your task is to guess that number. You will be given hint to guess the number. Play this game with your friends. Yes, I do know that this game will not be that you will wanting to play it day and night, but it can give you a little bit of fun.

So, I hope you will enjoy this game with your friends.


//guess my number
//the classic number guessing game
using namespace std;
int main()

srand(static_cast<unsigned int>(time(0))); //seed ranmdom number generator
int secretNumber=rand()%100+1;//rand numbner between 1 and 100
int tries=0;
int guess;
cout<<“\twelcome to guess my number\n\n”;
cout<<“enter a guess”;

cout<<“too high, don’t aim so high !\n\n”;
else if(guess<secretNumber)

cout<<“too low!\n\n”;

cout<<“\nthat’s it! you have get in “<< tries<<” guesses !\n”;


return 0;


the program’s exe file is right here!enjoy by opening this file.


Leave a Comment

Your email address will not be published. Required fields are marked *