diff --git a/day6/homework/h5.cpp b/day6/homework/h5.cpp new file mode 100644 index 0000000..5ad6f94 --- /dev/null +++ b/day6/homework/h5.cpp @@ -0,0 +1,15 @@ +#include + +using namespace std; + +int main() +{ + int a, b; + int outnum; // 输出的数字 + cout << "请输入两个整数: "; + cin >> a >> b; + + outnum = a > 0 ? (b > 0 ? a + b : a - b) : (b < 0 ? a * b : a - b); + cout << outnum << endl; + return 0; +} \ No newline at end of file