I am using Code:blocks 10.05 to compile my programs. I cannot seem to understand why code blocks does not recognizes the srand function. Look at the program above:
Can someone please explain this to me.
//Guess the secret number
# include <iostream>
using namespace std;
int myAbs (int i)
{
if (i < 0)
i += -1;
return i;
}
int main ()
{
int secret, guess, absError;
srand (time (0))
secret = 1 + rand ( ) % 100;
cout << "Enter the guess:";
cin >> guess;
absError = myAbs(secret - guess);
cout <<"You were out by"<< absError << endl;
Yeah, @Yanson is right. Code::Blocks isn't compiler, it's just an IDE. If you have the default compiler it would probably be GCC/G++, but technically you use Code::Blocks to sort of compile them so you can say you're both right.