0% found this document useful (0 votes)
42 views

Guessing Game Using C++

The document discusses the results of a study on the effects of a new drug on memory and cognitive function in older adults. The double-blind study involved 100 participants aged 65-80 and found that those given the drug performed significantly better on memory and problem-solving tests than the placebo group after 6 months. The drug was found to be safe and well-tolerated with no serious side effects reported.

Uploaded by

Benita Agbagwara
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Guessing Game Using C++

The document discusses the results of a study on the effects of a new drug on memory and cognitive function in older adults. The double-blind study involved 100 participants aged 65-80 and found that those given the drug performed significantly better on memory and problem-solving tests than the placebo group after 6 months. The drug was found to be safe and well-tolerated with no serious side effects reported.

Uploaded by

Benita Agbagwara
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

using namespace std;


int main()
{
string play;
cout<<"THIS IS A GUESSING GAME! \n"<<"Would you like to play? ";
cin>> play;
if(play =="yes")
{
int i= 1;
int x;
cout<< "Guess the number: ";
for(i=1; i<4; i++)
{
cin>> x;
if(x== 5827)
{
cout<<"You're a genius\n";
break;
}
else if (x !=5827 && i< 3)
{
cout<<" Try again: ";
}
else
{
cout<<"Seems like you really can't do this, \n";
}
}
string hint;
cout<< "Would you like a hint? ";
cin>> hint;
if (hint== "yes")
{
cout<<"It is a 4 digit number, with the 2 even numbers and odd numbers \n";
}
else if (hint=="no")
{
cout<< "Okay,continue \n";
}
else
{cout<<"You have entered an incorrect response!!\n";}

cout<<"Guess the number: ";


for (i=1; i<3; i++)
{
cin>> x;
if(x == 5827)
{
cout<<"Finally, what took you so long? \n";
break;
}
else if (x != 2 && i<2 )
{
cout<< "Hurry up, you only have 1 try left: ";
}
else
{
cout<<"You've run out of tries!!\n" << "Goodbye\n";
}

}
}
else if(play == "no")
{
cout <<"Okay, your loss\n" <<" Byeeeeeee\n";
}
else
{
cout<<"You have entered an incorrect input!\n"<< "Goodbye.\n";
}
return 0;
}

You might also like