Sep 2, 2015 at 10:46am UTC
Hello!
This is my first program and it's not working...
On Xcode, it shows lldb of the number I enter is bigger than the random number.
Thank you for your help!
#include <iostream>
#include <stdlib.h>
#include <time.h>
int main()
{
using namespace std;
unsigned int x;
srand (time(NULL));
x = rand() % 99 +1;
cout << "guess the number" <<endl;
int y;
cin >>y;
while (x!=y) {
if ( x < y ) {
cout << "too high, try again" << endl ;
cin >> y;
}
else {
cout << "too low, try again" <<endl ;
cin >> y;
}
}
cout << "congrats!";
return 0;
}
Sep 2, 2015 at 12:08pm UTC
There seems to be nothing wrong with this program. It is working on my computer.