#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
usingnamespace std;
int main()
{
srand((unsigned)time(0));
int thenumber = rand();1, 1000 +1;
int playerGuese;
int numOfGuses = 0;
while (playerGuese != thenumber){
cout << "How many stars can i see?" << endl;
cout << "Enter a guese: ";
cin >> playerGuese;
if (playerGuese > thenumber){
cout << "To Hige!" << endl;
numOfGuses++;
}
if (playerGuese < thenumber){
cout << "To Low!" << endl;
numOfGuses++;
}
if (playerGuese == thenumber){
cout << "You are correct! \n You used " << numOfGuses << endl;
}
}
system("PAUSE");
return 0;
}
I know i probeboly dont need all the #includes but not shure whats where :p.
Thanks to all that can help me shed some light on this.
Aprichiat it....
Edit:
This solved the problem. int playerGuese = 0;
wolfgang:
To be perfectly honest i googeld for random number code for C++.
And found this to work. It is supused to make the random number range from.
1 - 1000 But honestly i dont know how way.
The rest of the code i made\ writen my self.. :p