Click to See Complete Forum and Search --> : Assignment to do with Functions and Arrays


Maureen
04-22-2001, 05:51 PM
for this assignment I am required to design a system that will process students
information in a list or an array.

The system should facilitate the following activities on the list.
- Add a student to the list
- Delete a student from the list
- Amend information in the list
- Search the list for a student
- Sort the list
- Store students payment information
- Output a report that will show ID Number, Name and Payment Amount. (This
output must be included in the report to be submitted with the programme)

I need to utilize the proper use of functions and arrays.

Only two items of data are needed for the programme. ID Number and the name
of the student. I am suppose to use the index for the array as the ID Number.
I was told I will only need at least two arrays, one to store the names and
another to store payment information.

troy
04-22-2001, 06:10 PM
"Maureen" <maureengrubb@hotmail.com> wrote:
>
>for this assignment I am required to design a system that will process students
>information in a list or an array.
>
>The system should facilitate the following activities on the list.
>- Add a student to the list
>- Delete a student from the list
>- Amend information in the list
>- Search the list for a student
>- Sort the list
>- Store students payment information
>- Output a report that will show ID Number, Name and Payment Amount. (This
>output must be included in the report to be submitted with the programme)
>
>I need to utilize the proper use of functions and arrays.
>
>Only two items of data are needed for the programme. ID Number and the name
>of the student. I am suppose to use the index for the array as the ID Number.
>I was told I will only need at least two arrays, one to store the names
and
>another to store payment information.

you seem familiar, possibly from #c++ huh?
well anyways, i'd use a 3 dimensional array to store the person's name, and
id, and other students thereafter. use realloc to dynamically allocate more
storage as needed. use strcmp to compare input, say for a search one would
type in search "Troy", use a for loop to go through the array until and use
strcmp to compare the input with the names in the array. get a book and study
3d arrays. you could also use linked lists, but those are a pain in the ***,
the could be easier, but most people find recursion to be confusing.

jonnin
04-22-2001, 10:17 PM
make a struct of the items, make an array of those.

struct foo
{
int data;
float stuff;
char name[10];
};

foo adt[1000];

adt[0].stuff = 3.1415;

etc...

you can make it
foo * adt = (malloc, realloc to change)
if you want too.

thats to start. Try it, get a few of the pieces, ask when you
get stuck again...



"Maureen" <maureengrubb@hotmail.com> wrote:
>
>for this assignment I am required to design a system that will process students
>information in a list or an array.
>
>The system should facilitate the following activities on the list.
>- Add a student to the list
>- Delete a student from the list
>- Amend information in the list
>- Search the list for a student
>- Sort the list
>- Store students payment information
>- Output a report that will show ID Number, Name and Payment Amount. (This
>output must be included in the report to be submitted with the programme)
>
>I need to utilize the proper use of functions and arrays.
>
>Only two items of data are needed for the programme. ID Number and the name
>of the student. I am suppose to use the index for the array as the ID Number.
>I was told I will only need at least two arrays, one to store the names
and
>another to store payment information.