For a technical writing class I will be leading and having the rest of the class (on the school computers with Visual Studio 2013) participate in making a a simple guess game program. I am trying to make it as straight forward as possible and easy to understand as many of my classmates are not programmers.
Is there anything I can make simpler or easier to follow?
using namespace std;
int main(){
char response = 'y';
while (response != 'n'){
srand(time(NULL));
int guess = -1;
int answer = (rand() % 100) + 1;
while (guess != 0){
cout << "Guess a number between 1 and 100. Guess 0 to quit game." << endl;
cin >> guess;
if (guess == 0){
break;
}
else if (guess == answer){
cout << "Correct!" << endl;
break;
}
else if (guess < answer){
cout << "Too low, guess again!" << endl;
}
else {
cout << "Too high, guess again!" << endl;
}
}
cout << "Play again? (y/n): ";
cin >> response;
}
}