// Program takes a input a series of // integers prints a message indicating // whether it is even or odd // Exercise 3.21 in D&D #include // prototype for function that returns // 1 if the input is even, 0 otherwise int even(int numb); main () { int int1; cout << "Enter an integer (or -999 if done): "; cin >> int1; while (int1 != -999) { if (even(int1) == 1) { cout << int1 << " is an even number\n"; } else { cout << int1 << " is an odd number\n"; } cout << "Enter an integer (or -999 if done): "; cin >> int1; } return 0; } // function takes an integer and returns // 1 if the integer is even and 0 otherwise int even(int numb) { if ((numb % 2) == 0) return 1; else return 0; }