描述给定一个数N判断其正负。输入描述一个数N−10 9 =N=10 9 输出描述如果N 0 输出positive;如果N = 0 输出zero;如果N 0 输出negative希望能用c++编写代码。
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
if (N > 0) {
cout << "positive" << endl;
} else if (N == 0) {
cout << "zero" << endl;
} else {
cout << "negative" << endl;
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/iSh0 著作权归作者所有。请勿转载和采集!