>i need to change it so that the computer picks the number and the user guesses
Code:
#include <iostream>
#include <ctime>
using namespace std;
int main ( void )
{
int correct = 0,
userGuess,
compAnswer;
srand ( time ( NULL ) );
compAnswer = rand() % 100;
while ( !correct ) {
cout<<"Care to guess? ";
cin>>userGuess;
if ( userGuess > compAnswer )
cout<< "Too high\n";
else if ( userGuess < compAnswer )
cout<<"Too low\n";
else {
cout<< userGuess <<" was correct!\n";
correct = 1;
}
}
return EXIT_SUCCESS;
}
>void main ()
Don't use void main, it's wrong
-Prelude