Skip to content

nidhi10bansal/codsoft2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

codsoft2

#include //a prgrm that generates a random guess number and asks user to guess it. #include #include using namespace std; int main() {srand(static_casttime(0)); //the logic of random guess number int randomnum = rand()%100+1; int guess=0; cout<<"Welcome to the game,mate!"<<endl; cout<<"We have generated a random number guessing number 1 to 100.Please have fun with the game."<<endl; while(true){ cout<<"Enter your guess number:"<<endl; cin>>guess; //first we have to take input from the user then do the while loop and in while loop add if and else if for the right match for the users. if(guess<randomnum){ cout<<"Nope, too low!Try again."<<endl; //the guess is too low } else if(guess>randomnum){ cout<<"Nope, too high!Trt again."<<endl; //the guess is too high } else { cout<<"Woohoo! Correct match="<<randomnum<<endl; //right match break; } } return 0; }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published