Computer Science Canada saving help needed |
Author: | noobprogrammer123 [ Mon May 03, 2004 6:40 pm ] |
Post subject: | saving help needed |
how do i make a hall of fame type thing in a program, like when they have completed the game they can enter their name and it will save it |
Author: | Dan [ Mon May 03, 2004 7:23 pm ] |
Post subject: | |
well what u need to do is 1st make a file with some names and scorces somting like: Dan 1000000000 Tony 10000 Randa 1000 Martin 100 Asok 10 AsianSensation 1 JSBN 0 and load this file in to an array of strings and an array of ints witchs indexs corasponed. (this loading should be done at the start of the progame or any time b4 u need to save the high scorce file) then u sort the array of sorces and make shure to chage the array of names in the same way so they do not get mixed up. now u check to see if the curent players scorce is higher then any of the ones in the array, if it is delete the lowest enerty and move all the ones below the new higher score down one and put the new high scorce in that place. lastly to dum this data back in to a file in the same foramt u read it in. i know what i side sounds kind of cofisuing but the main things u need to know are: arrays sorting loops ifs all of witch u can lrean about in the tutorial section of the site. if u have more question about this i will be glad to help. (i know my explation is kind of confusing there) |
Author: | noobprogrammer123 [ Tue May 04, 2004 1:36 pm ] |
Post subject: | |
could you explain that a little using code |
Author: | Dan [ Tue May 04, 2004 6:45 pm ] | ||
Post subject: | |||
i just worte up this tutoiral on this, i made it up very fast so the spelling is bad and hopfully there are not big bugs or misatakes in it
if any ones sees anything wrong with it (other then spelling) or ways i could fix it up, plz let me know b4 i post this as a realy tutorial P.S. in case this dose not look good in just code tags i upload it as well |
Author: | noobprogrammer123 [ Wed May 05, 2004 4:31 pm ] |
Post subject: | |
when i put this into my program, for: prodedure sort it says, "procedure's may only be declared at the program, module, or monitor level" what does that mean? |
Author: | anywho_ya [ Wed May 05, 2004 4:40 pm ] |
Post subject: | problem |
when i ran this their was a problem with one of the for statements with all the i's something like (iii - 1) it said it had no value |
Author: | noobprogrammer123 [ Wed May 05, 2004 6:24 pm ] |
Post subject: | |
I didn't have a problem with the i |
Author: | anywho_ya [ Wed May 05, 2004 8:35 pm ] |
Post subject: | Problem |
Ya i definately have a problem with this: if scorse (iii - 1) < scorse (iii) then it says: Varible has no value |
Author: | anywho_ya [ Wed May 05, 2004 8:58 pm ] |
Post subject: | problem solved |
K i found the problem ... numOfPeople shoud be 3 not 13 |
Author: | Dan [ Wed May 05, 2004 9:18 pm ] |
Post subject: | |
you got to chage num of poleop for how many poleop u using in your file EDIT: OOOOOOOO opps thats a type-o in my file, thanks for catching that. alought u should chage it to w/e num of polep u using. |
Author: | Dan [ Wed May 05, 2004 9:20 pm ] |
Post subject: | |
noobprogrammer123 wrote: when i put this into my program, for:
prodedure sort it says, "procedure's may only be declared at the program, module, or monitor level" what does that mean? thats odd, trying puting the sort procedure at the top of your code. are u using any modules or class in it? the sort thing should not be in a procedure or anything but by it's self |
Author: | anywho_ya [ Mon May 10, 2004 8:13 am ] |
Post subject: | |
noobprogrammer123 wrote: when i put this into my program, for:
prodedure sort it says, "procedure's may only be declared at the program, module, or monitor level" This is prolly b/c u have another procedure. Meaning u have put this procedure inside ur other one. |
Author: | white_dragon [ Sat May 15, 2004 4:21 pm ] |
Post subject: | |
[quote="Hacker Dan"]you got to chage num of poleop for how many poleop u using in your file[/quote] wat do u mean by that???????? like does it mean the maximum amount of ppl able to input their name into it? |
Author: | SuperGenius [ Sat May 15, 2004 10:19 pm ] |
Post subject: | |
if you are using inflexible arrays to handle this task, you need to know how many names are on the list and put that number into the code or else you will get an error |
Author: | Dan [ Sat May 15, 2004 11:09 pm ] |
Post subject: | |
SuperGenius wrote: if you are using inflexible arrays to handle this task, you need to know how many names are on the list and put that number into the code or else you will get an error
yep, see the line "var numOfPeople : int := 3 " you can chage it there in my verson of the code. |