使用逻辑运算符实现以下条件:输入三个数,输出其中最小的数。
This commit is contained in:
parent
a7d39aa736
commit
485b93466b
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue