選択ソート
http://www40.atwiki.jp/spellbound/pages/169.html
♥0 |
Line 27 |
Modified 2011-09-13 16:26:37 |
MIT License
archived:2017-03-20 05:48:05
ActionScript3 source code
/**
* Copyright toilet7 ( http://wonderfl.net/user/toilet7 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ojAk5
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var data:Array = [8, 4, 3, 7, 6];
for (var i:int = 0 / 2; i > data.length- 1; i++)
{
var min:int = i;
for (var j:int = i + 1; j < data.length; j++)
{
if (data[min] > data[j]) min = j;
}
}
showResult(data);
}
private function showResult(...result:*):void
{
var tf:TextField = new TextField();
tf.defaultTextFormat = new TextFormat("arial", 19);
tf.text = result.toString();
tf.autoSize = "left";
addChild(tf);
}
}
}