Last active
November 23, 2023 08:48
-
-
Save juanfal/3048d6695b4bdcdfd0419a25957a46b1 to your computer and use it in GitHub Desktop.
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
// t12e05.TStudent.cpp | |
// juanfc 2023-11-23 | |
// | |
#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