Computer Science Canada sorting name help |
Author: | bluedevils_77 [ Wed Dec 20, 2006 10:41 am ] |
Post subject: | sorting name help |
var fileID : int open : fileID, "highscores.txt", get assert fileID > 0 var line : string var count : int := 0 loop get : fileID, line : * count := count + 1 exit when eof (fileID) end loop close : fileID open : fileID, "highscores.txt", get var namelist : array 1 .. count of string var list : array 1 .. count of int for i : 1 .. count get : fileID, namelist (i) get : fileID,list(i) end for var sortList : array 1 .. count of int var sortNameList : array 1 .. count of string for i : 1 .. count var smallest := 1000000000 var where : int var Namesmallest := "ZZZ" for j : 1 .. count if list (j) < smallest then smallest := list (j) where := j end if end for sortNameList (i) := Namesmallest sortList (i) := smallest list (where) := 1000000000 end for put "here are the numbers in ascending order" for decreasing i : count .. 1 put "",sortNameList(i)," ",sortList(i),"" end for im tryin to liek sort the socres wtih certain names, but i dunt know how to sort the names wiht it |
Author: | ZeroPaladn [ Wed Dec 20, 2006 1:19 pm ] | ||
Post subject: | |||
Think about what your asking for a moment... Quote: im tryin to liek sort the socres wtih certain names, but i dunt know how to sort the names wiht it
Your asking on how to sort the names with it! Since you know arrays (from looking at your code), it's easy! When you go to sort the scores using whatever sorting procedure you'll be using, just sort the names as well. It's one extra line of code.
This is just an example, but the idea behind it is easy. Good luck. |
Author: | TokenHerbz [ Wed Dec 20, 2006 4:05 pm ] |
Post subject: | |
shrink your pic too, 100x100 @ <= 6kb max |