求一个java程序, 学过array之后的练习题。关键是不知道思路啊

来源:百度知道 编辑:UC知道 时间:2024/06/17 20:16:38
write a program that reads a sequence of integers from the terminal windows and prints how many times the integers 0,1,2,...9 occur in the sequence with vertical colmns.Assume that the sequence is terminated by a negative interger.
ex: 0 2 1 1 4 5 6 6 6 8 9 9 8 6 1 4 8 -1
The results will be:
*
* * *
* * * * *
* * * * * * * *
==0==1==2==3==4==5==6==7==8==9==
上面输出结果是错的,html转换时出了问题,变形了。
简单来说就是要求每个数字的上面出现n个* ,n就是输入的数据当中包含某个数字的次数,比如0出现1次,就在0上方出现1次* ,6出现了4次,就需要在6上面垂直出现4个*

这里代码贴上去空格少了一个,这可不行,影响运行结果,
到这里看代码吧:
http://i94288.gofreeserve.com/ArrayTest.java

结果:http://i94288.gofreeserve.com/arrayTest.html