TStudent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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