回 帖 发 新 帖 刷新版面

主题:[讨论]救我!!!!!!!!!!!!

[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个回复)

沙发

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

板凳

Input a,b,c
If a < b Then a = b
If a < c Then a = c
Print a
End

3 楼

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 楼

不对啊,各位![quote]输入一个三位数,[/quote]你们的程序都要求输入几个数字了?

5 楼

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 楼

==要输入一个三位数哦
不好意思刚才失误了 :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 楼

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 楼

wzc1996 你盗版我的程序啊 ~~~~>_<~~~~~~~~~~
而且你的程序没有end是很不好的编程习惯啊
再说了?作为print是一些很古老的basic解释器的功能 叫初学者怎么懂啊
恩 而且没有注释 还要加行号 :P

9 楼

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 楼

楼上的跟我犯同样的错误
是 输入一个三位数 不是 输入三个数

我来回复

您尚未登录,请登录后再回复。点此登录或注册