Advertisement
athacks

even_tool

Mar 26th, 2014
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iomanip>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5. void doit();
  6.  
  7. int main(){
  8.     doit();
  9.     cout << "Bye!\n\n";
  10.     return(0);
  11. }
  12.  
  13. void doit() {
  14.     int val=0;
  15.     do {
  16.         cout << "Enter an integer (-999 to exit): ";
  17.         cin >> val;
  18.         if (val == -999){
  19.             break;
  20.         }
  21.         else if (val % 2 != 0) {
  22.             cout << val << " is an odd integer\n";
  23.         }
  24.         else if (val % 2 != 1) {
  25.             cout << val << " is an even integer\n";
  26.         }
  27.         cout << "\n";
  28.  
  29.     } while (val >= -998);
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement