主题:[讨论]救我!!!!!!!!!!!!
仙妮88
[专家分:0] 发布于 2007-08-06 10:56:00
[b]输入一个三位数,输出最大数。(解提思路和源代码请写下来)
我是第一期qbasic成员
[fly] 我是第一期qbasic成员 [/fly][/b][em10][em2][em18][em18][em18][em18][em18][em18][em18][em17][em17][em17][em17][em17][em54][em54][em54][em54][em54][em54][em21][em21][em21][em21][em21][em21][em19][em19][em19][em19][em8][em8][em8][em8][em47][em47][em47]
回复列表 (共13个回复)
沙发
yaoyusheng [专家分:460] 发布于 2007-08-06 13:32:00
input a,b,c
If a > b And a > c Then
Print a
Else
If b > a And b > c Then
Print b
Else
Print c
End If
End If
end
板凳
yaoyusheng [专家分:460] 发布于 2007-08-06 13:38:00
Input a,b,c
If a < b Then a = b
If a < c Then a = c
Print a
End
3 楼
yaoyusheng [专家分:460] 发布于 2007-08-06 13:48:00
If a < b Then x = a: a = b: b = x
If c > a Then
Print c, a, b
Else
If c > b Then
Print , a, c, b
Else: Print a, b, c
End If
End If
你也可以将它们排序.
4 楼
老大徒伤悲 [专家分:29120] 发布于 2007-08-06 16:13:00
不对啊,各位![quote]输入一个三位数,[/quote]你们的程序都要求输入几个数字了?
5 楼
lz27 [专家分:300] 发布于 2007-08-06 19:17:00
input a,b,c
if a>b and a>c then print a
if b>c and b>a then print b
if c>b and c>a then print c
end
6 楼
lz27 [专家分:300] 发布于 2007-08-06 19:21:00
==要输入一个三位数哦
不好意思刚才失误了 :P
应该是
l1:
input i
if i>999 or i<100 then goto l1
a=i\100
b=(i mod 100)\10
c=i mod 10 'a百位 b十位 c个位
if a>b and a>c then print a
if b>c and b>a then print b
if c>b and c>a then print c
end
7 楼
wzc1996 [专家分:1680] 发布于 2007-08-06 19:45:00
cls
10 input n
if n>999 or n<100 then goto 10
a=n\100
b=(n mod 100)\10
c=i mod 10
if a>b and a>c then ? a
if b>c and b>a then ? b
if c>b and c>a then ? c
8 楼
lz27 [专家分:300] 发布于 2007-08-06 19:51:00
wzc1996 你盗版我的程序啊 ~~~~>_<~~~~~~~~~~
而且你的程序没有end是很不好的编程习惯啊
再说了?作为print是一些很古老的basic解释器的功能 叫初学者怎么懂啊
恩 而且没有注释 还要加行号 :P
9 楼
小小傻瓜 [专家分:150] 发布于 2007-08-08 13:03:00
INPUT A,B,C
IF A>B THEN MAX=A ELSE MAX=B
IF MAX<C THEN MAX=C
PRINT MAX
解析
第一句:输入三个数
第二句:比较A,B两个数,A大就把A的值给MAX,B大就把B的值给MAX
第三句:这时MAX的值是A,B之中的大数,用它跟最后一个数比,如果比最后一个数小,MAX就是最后一个数,也就是最大数
第四句:输出最大数
10 楼
lz27 [专家分:300] 发布于 2007-08-08 16:32:00
楼上的跟我犯同样的错误
是 输入一个三位数 不是 输入三个数
我来回复