Climbing的专栏
Life is limited, but art is long
登录
注册
全站
当前博客
空间
博客
好友
相册
留言
huang Climbing
ID:hpdlzu80100
共
3123
次访问,排名
2万外
好友
4
人,关注者
7
人
热爱生活,积极向上,流自己的汗,吃自己的饭!
hpdlzu80100的文章
原创 23 篇
翻译 0 篇
转载 5 篇
评论 1 篇
最近评论
diqizhan:
很喜欢这个
文章分类
IT Industry and Career
(RSS)
Java Learning
(RSS)
Software Testing
(RSS)
Temp
(RSS)
收藏
相册
存档
2008年05月(4)
2008年04月(24)
软件项目交易
订阅我的博客
数组排序的Java实现(Sorting of arrays implemented with Java)
收藏
新一篇: 自然对数e及e的x次方的计算(Calculation of natural exponent e and x power of e)
|
旧一篇: 三角形构成判定(Judge whether 3 side lengths can form a triangle)
//
Find the largest 2 values in a set of values, using sorting algorithm
//
Java how to program, 5/e, chapter 4
import
javax.swing.
*
;
public
class
ModifiedMaximum
...
{
public
static
void
main(String args[])
...
{
int
MAX
=
10
;
int
[] number
=
new
int
[MAX];
int
temp;
String[] gradeText
=
new
String[MAX];
for
(
int
counter
=
1
;counter
<=
MAX;counter
++
)
...
{
gradeText[counter
-
1
]
=
JOptionPane.showInputDialog(
"
Enter Number of No.
"
+
counter);
number[counter
-
1
]
=
Integer.parseInt(gradeText[counter
-
1
]);
}
for
(
int
i
=
0
;i
<
MAX;i
++
)
for
(
int
j
=
i
+
1
;j
<
MAX;j
++
)
if
(number[i]
<
number[j])
...
{temp
=
number[i];
number[i]
=
number[j];
number[j]
=
temp;
}
JOptionPane.showMessageDialog(
null
,
"
The two largest number are:
"
+
number[
0
]
+
"
and
"
+
number[
1
],
"
Maximum
"
,JOptionPane.INFORMATION_MESSAGE);
}
}
发表于 @
2008年04月08日 10:05:00
|
评论(
loading...
)
|
编辑
新一篇: 自然对数e及e的x次方的计算(Calculation of natural exponent e and x power of e)
|
旧一篇: 三角形构成判定(Judge whether 3 side lengths can form a triangle)
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
登录