From 8401248063e9ca104fce8a1a4df8e8325cbdfa4d Mon Sep 17 00:00:00 2001 From: flykhan Date: Tue, 20 Jun 2023 08:50:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=85=A5=E4=B8=A4=E4=B8=AA=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=AE=83=E4=BB=AC=E9=83=BD=E6=98=AF?= =?UTF-8?q?=E6=AD=A3=E6=95=B0=EF=BC=8C=E8=BE=93=E5=87=BA=E5=AE=83=E4=BB=AC?= =?UTF-8?q?=E7=9A=84=E5=92=8C=EF=BC=9B=E5=A6=82=E6=9E=9C=E5=AE=83=E4=BB=AC?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E8=B4=9F=E6=95=B0=EF=BC=8C=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E5=AE=83=E4=BB=AC=E7=9A=84=E7=A7=AF=EF=BC=9B=E5=90=A6=E5=88=99?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=AE=83=E4=BB=AC=E7=9A=84=E5=B7=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day6/homework/h5.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 day6/homework/h5.cpp 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