I got it to work but now it doesn't do the calculations I inputted. Here is my script... The calculations are in the else if statements...
#include <iostream>
using namespace std;
int main()
{
int secretnumber = 77;
int num, num2, guessattempts=1-10;
//Greeting to the user
cout <<"\t\t\tWelcome to the guessing game!\n";
cout <<"\t\t\t_____________________________\n";
//Directions for the user
cout <<"Directions: ";
cout <<"You will have a total of 10 guesses to figure\n";
cout <<"\t what is the secret number.\n";
cout <<"\t The secret number lies between 1 to 100.\n\n";
//User input
cout <<"\t Please enter your chosen number.\n\t ";
cin >> num;
if ((num <=0 || num > 100))
{
cout <<"\t Please enter a number from 1 to 100.\n\n";
}
else if ( (num <1 && num >77) )
{
num2 = num - secretnumber;
cout <<"\t You are " << num2 <<"away from the secret number.\n";
cout <<"\t Try again.\n";
cout <<"\t You have " <<guessattempts<<" guess attempts remaining.\n";
}
else if ((num <77 && num >100))
{
num2 = num + secretnumber;
cout <<"\t You are " << num2 <<" away from the secret number.\n";
cout <<"\t Try again.\n\n";
cout <<"\t You have " <<guessattempts<<" guess attempts remaining.\n";
}
else if (num == 77)
{
cout <<"\t You guessed the right number! Congrats!";