Code:
#include <iostream.h>
#include <windows.h>
int main ()
{
int guess;
int trys=1;
int num=4; //or any other number
cout<<"Enter a guess number " << trys << ": ";
cin>>guess;
cin.ignore(80,'\n'); // i uselly need that
while(trys <=4) {// 4 tries
if(guess == num)
{
cout << "You guessed the right number!";
Sleep(1000);
return 0;
}
else
{
cout << "Try again" ;
Sleep(1000);
}
}
cout << " Sorry, but you faild!!!" << endl << "The number was " << num << endl;
cin.get();
return 0;
}
should work maybe a typo here or there, im to lazy to compile