I have an issue with this assignment, the instructor says that I use the brackets incorrectly that is why the program will not compile. Please provide feedback to correct program.
#include <iostream>
using namespace std;
int main()
{
system("color 4");
restart:
int number, ans;
number = rand() % 100 + 1;
int guess, tries=5;
do {
cout << "Can you guess my secret number? You have 5 tries, (1-100). "<< endl;
cout << "Enter guess number: ";
cin >> guess;
if (guess < number)
cout << "Too low, try again!" << endl;
else if (guess > number)
cout << "Too high, try again!" << endl;
else if (guess == 42);
cout << "Your guess is right!" << endl;
}
}
if (tries > 5)
{
cout << "You haven't guess my secret number. The secret number is 42. Would you like to start again?";
cout << "Press 'Y' or 'y', " << endl;
cin >> ans;
else if (ans != 'Y' || ans != 'y')
{
goto restart;
}
}
system("PAUSE");
return(0);
}