/* Chris Mooney COS 160 Mon. Wen. 5:30 to 6:45 Test assignment extra credit Test.cpp */ /* This program will read a sequence of positive integers and count how many are evenly divisible by 2 (even and how many are not evenly divisible by 2 (odd). Then the program will stop when a negative integer is read. And it will count up all the even and odd numbers and output them to the user */ # include # include # include # include main() { long number , even = 0 , odd = 0; cout << "Please have patients this may take a while.....\n\n"; while (number >= 0) { srand(time(NULL)); number = -1 + rand() % 100; if ((number % 2) == 0) even++; else odd++; } cout << "This program just calculated " << even << " even number(s), and " << odd << " odd number(s).\n\n"; return 0; } /* This is the programs output... Please have patients this may take a while..... This program just calculated 241459 even number(s), and 236219 odd number(s). Press any key to continue */