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

c++ project ideas, c++ project for engineering
c++ project ideas, c++ project for engineering

Let everyone know that you\'re techy!!!

FacebookRedditEmail this page



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
#include<iostream>
#include<cstdlib>
#include<ctime>
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”;
do
{
cout<<“enter a guess”;
cin>>guess;
++tries;
if(guess>secretNumber)
{

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

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

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

}

}
while(guess!=secretNumber);
return 0;
}

 

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

https://drive.google.com/open?id=1EgDyKyGCV396X-fFX4FC1XOZ229Ry6P7

Share this and have a good day!

Facebook

1 Comment

  1. //30 students ko marks stored in 3 subjects
    #include
    using namespace std;

    int main()
    {
    int s1[3],s2[3],s3[3];
    for(int i=0;i>s1[i]>>s2[i]>>s3[i];

    }

    //till now input taken then show this input
    for(int i=0;i<3;i++)
    {
    cout<<"the required marks in three subjects"<<s1[i],s2[i],s3[i];
    }

    return 0;
    }

Leave a Reply

Your email address will not be published.


*