prog4_05.cpp
来自「一本语言类编程书籍」· C++ 代码 · 共 21 行
CPP
21 行
// Program 4.5 Using the if-else
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main() {
long number = 0; // Store input here
cout << "Enter an integer less than 2 billion: ";
cin >> number;
cout << endl;
if(number % 2L == 0) // Test remainder after division by 2
cout << "Your number is even." // Here if remainder is 0
<< endl;
else
cout << "Your number is odd." // Here if remainder is 1
<< endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?