h=10*rand(1,10); %给定10个数的矩阵
for i=1:10
for j=10:-1:i+1
if h(j-1)>h(j)
t=h(j);h(j)=h(j-1);
h(j-1)=t;
end
end
end
disp(h)
var a = {2,3,1,4,5,8,7,9,6,10};
for(var i=0;i
for(var j=i+1;j
if(a[i] {
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
参考下吧
AHPU???方???