Hi all,
I have tried to make a little example of a random number generator for c++. However, as I am quite new in this language I do not know its peculiarities.
Here is the code
//g++ -o ran ran.cpp
#include <iostream>
using namespace std;
int main () {
int num;
for (int i = 0; i < 10; i++) {
num = rand() % i;
cout << num << endl;
}
}
This little code gives the above error. I have tried replacing the "i" variale with an specific number and it works.
Can anybody tell me why this happens?
I am using the following g++
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54)
Thank you!