// License: AGPLv3 or later. https://www.gnu.org/licenses/licenses.html /* Functions which are written specifically for A Big College (ABC) */ #ifndef _ABC_H_ #define _ABC_H_ #include struct input_files_name { std::string students; std::string subjects; std::string teachers; std::string results; // output-file }; struct input_files_textlines { std::vector students; std::vector subjects; std::vector teachers; }; struct teacher { /* teacher's index no.+1 is treated as teacher code which is used * internally in subject's struct as teachers who can teach those * subjects */ // int code; std::string name; int toughness; int variability; std::vector subjects; }; struct result { int subject_code; /* Even though redundant, it makes function statements a lot more * readable. */ std::string subject_name; int teacher_code; // Same as previous comment std::string teacher_name; int mean; int standard_deviation; int marks; std::string grade; }; struct student { std::string name; std::string code; int ability; int consistency; std::string program; // Only the last attempt of every subject is added to overall_marks int overall_marks = 0; /* Following calculation is used to obtain percentage upto two decimal * points precision only: * ((float)((overall_marks*100)/subjects_studied)/100.0) */ float percentage; /* If fail, F will be added at exclusion time. Else, will be * calculated based on percentage. */ std::string overall_grade_or_status = "?"; std::vector subjects; // used for calculating overall percentage int subjects_studied = 0; std::vector results; }; struct subject { // subject's index no.+1 is treated as subject code // int code; std::string name; int difficulty; int variability; std::vector teachers; }; input_files_name perform_checks_on_args( int argc, char *argv[]); input_files_textlines read_input_files( input_files_name file_names); std::vector generate_students_struct( std::vector students); std::vector generate_subjects_struct( std::vector subjects); std::vector generate_teachers_struct( std::vector teachers); void add_teachers_vector_index_number_to_subjects_struct( std::vector &teachers, std::vector &subjects); void process_students_and_generate_results( std::vector &students, std::vector &subjects, std::vector &teachers); void write_results_to_output_file( std::vector &students, std::string results_file_name); int pick_teacher_randomly(std::vector teachers_codes); std::string return_grade_for_float(float percentage); #endif