<<split from some other thread>>
Hey guys I attempted this program for fun and was wondering what I need to change for this to work properly? Currently it will display one random number at a time a whole bunch of times then when it hits zero it will always say count is 25.
Code:#include <iostream> #include <ctime> using namespace std; int main () { int random, count, i; for (i = 1; ; ++i){ srand(time(NULL)); random = rand() % 10; cout << random << endl; if(random == 0){ break; } } while (i == random){ count++; } cout << count; system ("pause"); return 0; }



LinkBack URL
About LinkBacks



