Hi guys, im new to any kind of coding and am loving it. Ive been writing a simple little number guessing game, and have a question. The question is in the code. Thanks
Please ignore alignment lol. Does not look like this is Editor.Code:#include <iostream> #include <windows.h> using namespace std; int main() { //SetConsoleTitle("The Guessing Game!"); int guess; int clue; cout << "Hello Internet\n"; cout << "Today, we are going to play the Guessing Game!\n"; cout << "\n"; cout << "You are going to pick a number from 1-100 and if you need help\n" << "Id be happy to give you clues!\n" << "\n"; cout << "Pick a number: "; cin >> guess; cout << "\n"; cin.ignore(); if ( guess < 74 ) { cout << "Sorry, you guessed wrong!\n"; cout << "Would you like a hint?\n" << "\n" << "\n" << "<y/n>"; char clue; cin >> clue; if ( clue =='y' ) { cout << "You guessed low, sorry! Try again!\n"; } else { // How do I send the user back up to cin >> guess at the earlier point in the code? } } else if ( guess > 74 ) { cout << "Sorry, you guessed wrong!\n"; cout << "Would you like a hint?\n" << "\n" << "\n" << "<y/n>"; char clue; cin >> clue; } else { cout << "You won the game!\n"; } cin.get(); return 0; }



LinkBack URL
About LinkBacks



