Student's Basic Information and Grades

Create a program that would let the user manage students' basic information and grades on a number of subjects dynamically.

The program should accept the following fields with the strict validations mentioned per item:
a. Number of Students to encode
• Validation: Should only accept numbers or integers.
• Prompt: Not a number. Reinput number of students:
b. Number of Grades to encode
• Validation: Should only accept numbers or integers.
• Prompt: Not a number. Reinput number of grades:
*Depending on the inputted number of students the user should input the ff:
a. Student Number
• Validation: Should only accept numbers or integers and 10 digits only.
• Prompt:
o Not a number. Reinput student number:
o Reinput student number. It should be 10 digits only:
• (BONUS item: should be unique, do not accept existing student number)
o (Prompt: Student Number already exists. Reinput unique student number:)
*Depending on the inputted number of grades the user should input the ff:
b. Grade on nth Subject per student.
• Validation: should be able to accept numbers w/ decimals and digits from 1 to maximum until 100 only.

Prompt:
o Not a number. Reinput grade:
o Reinput grade. It should be between 1 to 100 only:

After encoding all the details, show all the encoded grades with computed average grades (based on all inputted grade sizes) with results equivalent based on the criteria.
• Table header grades section should be dynamically generated, concatenate "G" plus the number of subjects displayed on the column.
• Get the average grade by adding all subject grades per row (excluding the student number column) divided by the array size.
o aveGrade = aveGrade/(grade_count)
• Get the result using the following criteria:
o If aveGrade <= 60: result = "Failed"
o Else if aveGrade <= 75: result = "Needs Improvement"
o Else if aveGrade <= 85: result = "Satisfactory"
o Else if aveGrade <= 90): result = "Good"
o Else if aveGrade <= 100): result = "Excellent"

Use a Two-Dimensional Array for the student number and grade saving.

I tried to make a few lines of code, here my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  #include <iostream>

using namespace std;

int main()
{
    int numStud;
    int numGrade;
    double grades[] = {0};
    int studNumber[] = {0};

cout << "Number of Students to encode: ";

    while (!(cin >> numStud))
    {
        cout << "Not an integer. Reinput number of students: ";
        cin.clear();
        cin.ignore(123, '\n');
    }



    cout << "Number of Grades per student to encode: ";

    while (!(cin >> numGrade))
    {
        cout << "Not an integer. Reinput number of grades: ";
        cin.clear();
        cin.ignore(123, '\n');
    }

    cout << "-------------------------------------------------------" << endl;
    cout << "Start Encoding Student Grades!" << endl;
    cout << endl;

    for (int i = 0; i < numStud; ++i){
        cout << "Student No. " << (i+1) << ") Enter Student Number: ";
        cin >> studNumber[i];

        cout << "Encode " << studNumber[i] << "'s Grades: " << endl;

        for (int z = 0; z < numGrade; ++z){
            cout << "Enter Grade on Subject " << (z+1) << ": ";
            cin >> grades[0];
        }
        cout << endl;
    }
    return 0;
}
L9 & 10 - you need to specify the size of the arrays. In C++ the size has to be known at compile time. If you need to use a c-style array here as opposed to say a std::vector then you'll need to set the array size to be a maximum allowed value and check that the number of elements set don't exceed this value.

Use a Two-Dimensional Array for the student number and grade saving.


You've used 2 one-dimensional arrays as opposed to 1 two-dimemsional.
Last edited on
Topic archived. No new replies allowed.