网络考试系统怎样随机调换选择题的位置?
网络考试系统怎样随机调换选择题的位置?就是说它的答案有 我、你、他。不一定A我 B你 C他 D它,或者A你 B我 C他 D它也行。怎样的算法最简单,而且要核对答案的算法最简单?
[解决办法]
unit customSort;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; function asort(List:TstringList;index1,index2:integer):integer;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var stringList:TstringList;beginstringList:=TstringList.Create;stringList.Add('我');stringList.Add('你');stringList.Add('他');stringList.Add('她');stringList.CustomSort(asort);showmessage(stringList[0]+';'+stringList[1]+';'+stringList[2]+';'+stringList[3]+';');end;function asort(list:TstringList;index1,index2:integer):integer; beginResult := Random(3-1+1); end;end.