|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I could use a real good hand with arrays. I am writing a program that does the following;
A function Inputs a subject (string Subject) A separate function then loops the input of Student Number (int StudentNumber) and Grade (char StudentGrade) (A, B, C, D) until user exits by selecting 0 in student number. The program must provide arrays for the following pre-written function which sorts each student number by GPA. The program must then list Student Numbers, GPA’s and the number of subjects each student number took part in; /**************************************************************************** SortByGPAs Process: Sort arrays in descending order by GPA - insertion sort When GPAs are equal, sort in descending order of NumSubjs input: int NextIndex: First unused position in arrays int StudIds[]: array of student nos - to be sorted int SumOfGrades[]: array of sums of grades - to be sorted int NumSubjs[]: array of number of subjects - to be sorted output: int StudIds[]: array of student nos - sorted int SumOfGrades[]: array of sums of grades - sorted int NumSubjs[]: array of number of subjects - sorted PHP Code:
The system must determine if the student has been entered previously for another subject, if not insert new student information into the arrays; the student number, the numerical grade for that subject and number of subjects. Since characters are an ordered sequence character are converted to numeric equivalents. Static_cast<int>(‘C”) I currently have Subject as a string, StudentNumber as an integer and StudentGrade as a character, how can I put these into arrays that can be used by this function (passing through main). As I have very basic knowledge of arrays and readings aren’t helping, thanks to anyone that can help. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Need help with Arrays!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|