怎样编写以下程序:编写BASIC程序,输入20个数,并按从小到大的顺序输出

解决方案 »

  1.   

    首先从20个数中选出最小的,然后将最小的与第一个数交换位置,然后在剩下的数中选出最小的,与第二数交换位置,依次类推,从小到大排列所有的数.
    dim i as long, l as long, n as long
    for i=0 to 19
       for l=i to 19
          if a(i)>a(l) then
             n=a(i)
             a(i)=a(l)
             a(l)=n
          end if
       next l
       debug.print a(i)
    next i
      

  2.   

    BASIC的?运行时从键盘输入吗?
    十五、六年没有用“BASIC”了,记不清楚BASIC如何从键盘读取数据了。排序和输出是很简单的。