概述
5.
Write a ConsoleProgram that reads in a list of integers, one per line, until a sentinel value of 0 (which you should be able to change easily to some other value). When the sentinel is read, your program should display the smallest and largest values in the list, as illustrated in this sample run:
Your program should handle the following special cases:
- If the user enters only one value before the sentinel, the program should report that value as both the largest and smallest.
- If the user enters the sentinel on the very first input line, then no values have been entered, and your program should display a message to that effect.
程序源代码:
最后
以上就是奋斗御姐为你收集整理的斯坦福大学开放课程——编程方法 作业2 - 5的全部内容,希望文章能够帮你解决斯坦福大学开放课程——编程方法 作业2 - 5所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复