Search code examples
arraysalgorithmpseudocode

Pseudocode - How I can do the array in this?


I have a homework that asks this:

Make an algorithm and pseudocode, which will ask 20 grades of 20 students, including the student's name, degree and enrollment, all this must be stored in an array. After data entry, it will print the average of all students per group, (suppose you enter data of different groups of students).

Although I understand everything, I have only a few questions about this. The first is that I do not know how to organize (or make) the array and how to group students' degrees/class.

EDIT: I don't know much about pseudocode, because no one have taught me how to do this, so don't expect too much from me.

set StudentArray[20,23]
    for j=1 to 20
        StudentArray[j,21] = prompt Name
        StudentArray[j,22] = prompt Degree
        StudentArray[j,23] prompt RegNum
        for k=1 to 20
            StudentArray[j,k] = prompt Grade
        end for
    end for

Make the average of students grades method is easy contnuing with this pseudocode. The problem here is if the array "StudentArray" 'accepts' differents data types (integers or numbers, strings, etc.). And I have no idea how "group the students".


Solution

  • Is your problem with the different data types? Depending on your programming language, your array may or may not be able to hold different data types. If this is not possible in the language you are using, you will have to hold an array for each data type, or create a new complex data type.