简单啊,给你吧。
Private Sub Command1_Click()
x = InputBox("输入第一个数:")
y = InputBox("输入第二个数:")
z = InputBox("输入第三个数:")
Print " x y z"
Print "排序前 ", x, y, z
Print "排序后 ";
If x > y And x > z Then
If y > z Then
Print " ", x, y, z
Else
Print " ", x, z, y
End If
End If
If x > y And x > z Then
If y > z Then
Print " ", x, y, z
Else
Print " ", x, z, y
End If
End If
If y > x And y > z Then
If x > z Then
Print " ", y, x, z
Else
Print " ", y, z, x
End If
End If
If z > y And z > x Then
If y > x Then
Print " ", z, y, x
Else
Print " ", z, x, y
End If
End If
End Sub
界面自己做,把这段程序放到按钮的CLICK事件中。
定义一个 数组 接受你输入的3个数字
int[] a = new int[3];
a[1]=x;
a[2]=y;
a[3]=z;
for(int i=0;i
for(int j=0;j
if(a[i]{
int temp=0;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
不是的吧,这个问题咋这么多人问呢