I am trying to write a random number generator...But it keeps spitting out the same three numbers . What am I doing wrong?
Code:#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int defRand; char answer; int x; for(x = 1; x <= 3;) { defRand = 1 + rand() % (10 - 1 + 1); cout << defRand << endl; cout << "Do you accept this value?: \n" << "Enter 'Y' for yes" << " and 'N' for no."; cin >> answer; if(answer == 'Y' || answer == 'y') { break; } else { x++; } } system("PAUSE"); return EXIT_SUCCESS; }