مشكل ترتيب قاعدة بيانات
#5
لا ليست غنية عن كل توظيح

فإذا أردت ترتيب الطلبة فأين الرتبة 4 ، 5 و 7 ؟؟؟؟؟؟؟؟

المهم ..

هذا هو طرحي بالإعتماد على خوارزمية الترتيب :

ستكون النتيجة كما كالآتي


[صورة: 559d3b3.gif]

كود :
procedure Sorting; var NoteTable : Array[1..8]of real; NumTable : Array[1..8]of integer; i : integer; Temp : Real; Found : Boolean; begin with Grid1 do begin NoteTable[1] := StrToFloat(Cells[0,1]); NoteTable[2] := StrToFloat(Cells[0,2]); NoteTable[3] := StrToFloat(Cells[0,3]); NoteTable[4] := StrToFloat(Cells[0,4]); NoteTable[5] := StrToFloat(Cells[0,5]); NoteTable[6] := StrToFloat(Cells[0,6]); NoteTable[7] := StrToFloat(Cells[0,7]); NoteTable[8] := StrToFloat(Cells[0,8]); end; repeat Found := False; For i := 1 To length(NoteTable)-1 do If NoteTable[i] < NoteTable[i+1] Then // ترتيب تنازلي [color=Blue]// If NoteTable[i] > NoteTable[i+1] Then // ترتيب تصاعدي[/color] begin Temp := NoteTable[i]; NoteTable[i] := NoteTable[i+1]; NoteTable[i+1] := Temp; Found := True; end; until Found=false; NumTable[1]:=1; For i := 1 To length(NoteTable)-1 do If NoteTable[i] = NoteTable[i+1] Then NumTable[i+1]:= NumTable[i] else NumTable[i+1]:= NumTable[i]+1; with Grid2 do begin Cells[0,1] := inttostr(NumTable[1]); Cells[0,2] := inttostr(NumTable[2]); Cells[0,3] := inttostr(NumTable[3]); Cells[0,4] := inttostr(NumTable[4]); Cells[0,5] := inttostr(NumTable[5]); Cells[0,6] := inttostr(NumTable[6]); Cells[0,7] := inttostr(NumTable[7]); Cells[0,8] := inttostr(NumTable[8]); end; with Grid2 do begin Cells[1,1] := floattostr(NoteTable[1]); Cells[1,2] := floattostr(NoteTable[2]); Cells[1,3] := floattostr(NoteTable[3]); Cells[1,4] := floattostr(NoteTable[4]); Cells[1,5] := floattostr(NoteTable[5]); Cells[1,6] := floattostr(NoteTable[6]); Cells[1,7] := floattostr(NoteTable[7]); Cells[1,8] := floattostr(NoteTable[8]); end; end;

في الشيفرة أعلاه أعرض المبدأ وهو خوارزمية الترتيب، واعتمدت الجداول الوسيطة لوضوح الشيفرة

تحياتي Smile
الرد


الردود في هذا الموضوع
مشكل ترتيب قاعدة بيانات - بواسطة xinofix - 29-03-2008, 10:56 AM
مشكل ترتيب قاعدة بيانات - بواسطة merouane - 29-03-2008, 05:09 PM
مشكل ترتيب قاعدة بيانات - بواسطة xinofix - 29-03-2008, 06:26 PM
مشكل ترتيب قاعدة بيانات - بواسطة merouane - 29-03-2008, 07:22 PM
مشكل ترتيب قاعدة بيانات - بواسطة مهدي - 31-03-2008, 01:42 PM
مشكل ترتيب قاعدة بيانات - بواسطة xinofix - 31-03-2008, 07:32 PM
مشكل ترتيب قاعدة بيانات - بواسطة مهدي - 31-03-2008, 08:26 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم