如何查找最高和最低数量的用户输入。 [英] How to find the highest and lowest number of user input.

查看:88
本文介绍了如何查找最高和最低数量的用户输入。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我有个问题。我正在为我的班级开设一个程序,而且我一直在寻找如何找到最低和最高数量的用户输入。我们还没有阵列,所以这是不可能的,但是找到最高和最低的另一种方式是什么。我记得听过cout<<<<<"在课堂上,但忘了。我也可以尝试if else语句,但看起来很多工作。我希望我明白这一点,但底线是如何找到用户输入的最低和最高数量(5个输入)。在此先感谢。

Hello again guys. I have a question. I''m working on a program for my class and I''m stuck on how to find the lowest and highest number of a user input. We aren''t at arrays yet so that''s out of the question, but what would be another way of finding the highest and lowest. I remember hearing something in the lines of "cout <<" in class, but forgot. Also I could try the if else statement, but would seem like alot of work. I hope I am making this clear, but bottom line is how to find the lowest and highest number of a user input ( 5 inputs). Thanks in advance.

推荐答案



我们可以在不需要数组的情况下完成。在这里,我试图解释逻辑......

你可以实现它。


1)min和max是两个无符号整数变量。

min初始化为可能的最大值,

max初始化为零。

2)循环以下三个语句n次。

读取一个数字。

如果数字是< min,then min = number。

如果数字是> max,then max = number。


3)最后打印min,max
Hi,
we can do it without need of array. Here i am trying to explain the logic...
You can implement it.

1) min and max are two unsigned integer variables.
min is initialized with possible maximum value,
max is initialized with zero.
2) Loop the following three statements for n times.
Read a number .
if the number is < min, then min = number.
if the number is > max, then max = number.

3) Finally print min, max





我们可以在不需要数组的情况下完成它。在这里,我试图解释逻辑......

你可以实现它。


1)min和max是两个无符号整数变量。

min初始化为可能的最大值,

max初始化为零。

2)循环以下三个语句n次。

读取一个数字。

如果数字是< min,then min = number。

如果数字是> max,then max = number。


3)最后打印min,max
Hi,
we can do it without need of array. Here i am trying to explain the logic...
You can implement it.

1) min and max are two unsigned integer variables.
min is initialized with possible maximum value,
max is initialized with zero.
2) Loop the following three statements for n times.
Read a number .
if the number is < min, then min = number.
if the number is > max, then max = number.

3) Finally print min, max



您好,让我看看我是不是做对了。因此用户输入5个整数,并将其初始化为a,b,c,d和e all int。然后,我将如何做... ...找到分钟

Hello, let me see if I am getting this right. So the user input 5 integers and that will be initialized into a,b,c,d, and e all int. Then how would I would do something like... to find the min

展开 | 选择 | Wrap < span class =codeDivider> | 行号


展开 | 选择 | Wrap | 行号


这篇关于如何查找最高和最低数量的用户输入。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆