I wrote a random number generator code (25 #'s between 0 & 99)and now i need to list odds and evens separately but i dont quite know how. I know if %2==0 means even else odd but i dont know how to write it here...output should look like:
ODD: 21 21 87 39 45 7 75 71 87 9 81 27 57
EVEN: 26 64 2 74 0 40 84 0 82 0 32 90
Can someone assist me with this please.
Code:#include <cstdlib> #include <iostream> #include <ctime> using namespace std; int main() { int x = 0; srand(time(0)); for (int x = 1; x < 26; x++) cout << 0+(rand()%100) << endl; system("PAUSE"); return 0; }