#include <iostream> using namespace std; inline int even(int x) { return !(x % 2); } int main() { if (even(10)) cout << "10は偶数です\n"; if (even(11)) cout << "11は偶数です\n"; return 0; }
$ g++ sample13.cpp $ ./a.out 10は偶数です
#include <iostream> using namespace std; inline int even(int x) { return !(x % 2); } int main() { if (even(10)) cout << "10は偶数です\n"; if (even(11)) cout << "11は偶数です\n"; return 0; }
$ g++ sample13.cpp $ ./a.out 10は偶数です