Author |
Message |
Sehroz
|
Posted: Wed Jan 09, 2008 5:46 pm Post subject: Array Records!! |
|
|
Hey im having trouble even starting my program for school if theres any computer geniuses out there:| help me out lol.
Il break down the steps to what the program should basically do theres other stuff but i can do that by mself..lol.
1.Create a array of records that consist of the first name,phone number, and average.
2.Then it should call a procedure in which the user will enter 5 records into the array at the beginning of the program
3. The hardest part... once the data has been inputed the program should call a highestMark which will search for the highest mark. Like starting from the second record compare the mark of that record to the current highest mark which is initally set to the first record. but if the mark of the second record is higher then first one then replace it. after the last record has been checked return the highestmark as the result and call a procedure to printArray
I tried that but i just cant seem to catch onto this record thing i know its alot of work:| but can someone plllleassee help me!!
Il post my program if it starts to work but till then can someone please help!! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
Sehroz
|
Posted: Wed Jan 09, 2008 6:07 pm Post subject: Re: Array Records!! |
|
|
i read that but thats pretty easy steps 2 and 3 mess me up! |
|
|
|
|
|
Tony
|
Posted: Wed Jan 09, 2008 6:10 pm Post subject: RE:Array Records!! |
|
|
there shouldn't be much difference between searching for a highest mark in an array, and a highest mark in an array of records.
It's just that instead of my_array[num] you'll be using my_array[num].mark for comparisons. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sehroz
|
Posted: Wed Jan 09, 2008 6:13 pm Post subject: Re: Array Records!! |
|
|
k so first off what would be the procedure for making the user enter 5 records into the array at the beginning? |
|
|
|
|
|
Nick
|
Posted: Wed Jan 09, 2008 6:16 pm Post subject: RE:Array Records!! |
|
|
don't think you're bad at this stuff because you can't grasp this, I was top of my class but still couldn't grasp records until after the class finished however you can do it, just keep trying and you will figure it out!
(noted I didn't have the knowledge of compsci.ca at the time to help me out) |
|
|
|
|
|
Zampano
|
Posted: Wed Jan 09, 2008 6:21 pm Post subject: Re: Array Records!! |
|
|
On the note of the maximum numbers, is there any reason that the max can only accept two arguments? It seems logical for there to be more than one argument. |
|
|
|
|
|
Sehroz
|
Posted: Wed Jan 09, 2008 6:28 pm Post subject: Re: Array Records!! |
|
|
wat maximum argument ... how would i do step 2 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zampano
|
Posted: Wed Jan 09, 2008 7:16 pm Post subject: Re: Array Records!! |
|
|
Sorry; for step two, perhaps you should use a for loop. Each time through, you will ask the user for
code: | arrayname(counter).recordvariable:=whatever |
Is the problem you are have trouble with a syntax or a structure-related problem? You probably already know how to do basic looping and all because you are at records in school so I can only assume the problem relates to the syntax for records (or what they are useful for).
The syntax becomes routine shortly, though it's not to obvious what you should use records for. Whenever you have a multidimensional array where you want to store different types in different 'rows' of the array, that is when you are supposed to use a record in my opinion. |
|
|
|
|
|
Sehroz
|
Posted: Thu Jan 10, 2008 4:20 pm Post subject: Re: Array Records!! |
|
|
so far i have this.....
type StudentMarks :
record
FirstName : array 1 .. 10 of string (20)
LastName : array 1 .. 10 of string (20)
PhoneNumber : array 1 .. 10 of string (12)
Marks : array 1 .. 10 of int
end record
procedure fillarray
var FirstName: array 1.. 10 of string (20)
var LastName : array 1 .. 10 of string (20)
var PhoneNumber : array 1 .. 10 of string (12)
var Marks : array 1 .. 10 of int
for i:1 .. 10
var count : int :=0
count:=count+1
put " enter first name of student." , count
get FirstName (count)
put " enter last name of student." , count
get LastName (count)
put " enter phone number of student." , count
get PhoneNumber (count)
put "enter marks of student:" , count
get Marks (count)
end for
end fillarray
BUT i dont kw wat to do next!!! |
|
|
|
|
|
|