Okay well I know this is a no brainer to most of you but I am brand new to the language and programming so could I get some help . Basically I want to make a quick game where you have to guess a number within 5 tries.
Its pretty crazy what happens when you execute my program i've created an endless loop of some kind.
Code:#include <iostream.h> int main() { //declerations int guess=0; //ammount of guesses int UserNum=0; //the number the user guested int GenNum=10; //the random number, 10 until i figure out how ro rand cout<<"Please guess a number between 1-100: "; cin>>UserNum; while(guess!=5) //as long as guess isnt 5 keep going if (UserNum==GenNum) { cout<<"You win!"; break; } else cout<<"Please try again!"; cin>>UserNum; guess++; cout<<"You Lose"; return 0; }