This isnt much of a first post, but im learning and wanted to put together something off the top of my head a "small game"
The problem is that it allways gives me the command like if i pick the number 3, it gives me the words "Your too low, Congrats you win!!"
Am I doing else wrong, why does it display the win command when I didnt win. Also can anyone point me to a way to recycle it so if u dont get the number right it doesnt terminate.
Code:
#include <iostream>
using namespace std;
int main()
{
int number;
cout<<"Please input a number: \n";
cin>> number;
cin.ignore();
cout<<"You inputted: "<< number << "\n";
cin.ignore();
if ( number < 5 )
cout<< " You are too low\n";
else if ( number > 5 )
cout<< " You are too high\n";
else ( number == 5 );
cout<< " Congrats you win!!\n";
cin.get();
}