使用逻辑运算符实现以下条件:输入三个数,输出其中最小的数。

This commit is contained in:
flykhan 2023-06-20 08:52:06 +08:00
parent a7d39aa736
commit 485b93466b
1 changed files with 15 additions and 0 deletions

15
day6/homework/h9.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cout << "请输入三个数: ";
cin >> a >> b >> c;
int min = a < b ? (a < c ? a : c) : (b < c ? b : c);
cout << "其中最小的数是: " << min << endl;
return 0;
}