Code:
#include <iostream>
using namespace std;
int main()
{
int a,c,guess,number=45;
char play;
cout<<"hya. Lets play guess my number";
cout<<"\nIf you are too high, i will tell you so, and if you are too low, I will tell you so";
cout<<"\nBUT ONLY IF YOU ARE MORE THAN FIVE NUMBERS AWAY!!";
cout<<"So, do you want to play? (y or n)\n";
cin>> play;
cin.ignore();
if(play=="y")
{
cout<<"Great. Im so excited, aren't you!!\n";
cout<<"ok, i am thinking of a number between one and one hundred...\n";
cout<<"okay, guess away!\n";
cin>> guess;
if (guess > number || guess < number && !(guess + 5==number || guess - 5==number)
cout<< "nice try, but not correct";
if (guess > number && guess < 100)
cout<< "you were too high";
if (guess < number && guess > 0)
cout<< "you were too low";
else ;
else
if (guess > (answer - 6) && guess < (answer + 6))
cout<< "wow, you were within six integers of my number, nice job.";
else
cout<< "Please enter a number between zero and one hundred."
}
}
i know that there are things lacking at the end, but other than that, what is wrong? btw, i am kind of a code newbie, so i am still learning this stuff.
thanx