使用嵌套的if/else语句查找最多3个数字 [英] Finding maximum of 3 numbers using nested if/else statements

查看:144
本文介绍了使用嵌套的if/else语句查找最多3个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在上大学,并且正在使用C#编写程序,除了该按钮之外,该程序几乎已完成.我不想要答案,因为我永远不会那样学习,但是我正在使用Heron方法编写程序,用户必须输入3个数字来确定这些数字是否可以用作三角形的边.我感到困惑的一个按钮是查找最大"按钮,该按钮希望程序显示输入的数字最大.教授希望使用嵌套的if/else语句编写此代码.我已经在网上搜索过,因此该课程的书非常糟糕.有人可以通过可能的网站帮助我吗?那将不胜感激.

So I'm in college and I'm writing a program using C# which is ALMOST done except for this button. I don't want the answer because I'll never learn that way, but I'm writing a program using Heron's method where the user has to input 3 numbers to determine if these numbers can be used as sides of a triangle. The one button I am confused with is the Finding the Maximum button which wants the program to show which number entered is the highest. The professor wants this code to be written using nested if/else statements. I have searched online and the book for the course is terrible. Could someone help me with a possible web site to help or maybe an example? That would be GREATLY appreciated.

推荐答案

也许您可以使用两层嵌套的Math.Max(v1,v2)请求来编写它.然后将其转换为必要的If/else子句.如果您下载 ILSpy 并检查System.Math.Max来了解.Net的用处,也许您可​​以获得积分.

Perhaps you could write it using a two-level nested Math.Max(v1, v2) request. Then translate that into the necessary If/else clauses. Maybe you can get bonus points if you download ILSpy and inspect System.Math.Max to see what .Net uses under the covers.

这篇关于使用嵌套的if/else语句查找最多3个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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