Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TStudent
// t11e05.TStudent.cpp
// juanfc 2022-01-16
//
#include <iostream>
#include <array>
using namespace std;
const int MAXNOSBJ = 50;
typedef array<int,MAXNOSBJ> TSubjects;
typedef array<float,MAXNOSBJ> TMarks;
struct TStudent {
string ID;
TSubjects subject;
TMarks mark;
int nSubjects;
};
float minGrade(TStudent st)
{
float min = st.mark[0];
for (int i = 1; i < st.nSubjects; ++i)
if (st.mark[i] < min)
min = st.mark[i];
return min;
}
bool overMark(TStudent st, int mark)
{
int i = 0;
while (i < st.nSubjects and st.mark[i] >= mark)
++i;
return i == st.nSubjects;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment