Assignment 1 pdf and submitted solution files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.9 KiB

// License: AGPLv3 or later.
/* Functions which are written specifically for A Big College (ABC)
#ifndef _ABC_H_
#define _ABC_H_
#include <vector>
struct input_files_name
std::string students;
std::string subjects;
std::string teachers;
std::string results; // output-file
struct input_files_textlines
std::vector<std::string> students;
std::vector<std::string> subjects;
std::vector<std::string> 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<int> 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<int> subjects;
// used for calculating overall percentage
int subjects_studied = 0;
std::vector<result> results;
struct subject
// subject's index no.+1 is treated as subject code
// int code;
std::string name;
int difficulty;
int variability;
std::vector<int> 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<student> generate_students_struct(
std::vector<std::string> students);
std::vector<subject> generate_subjects_struct(
std::vector<std::string> subjects);
std::vector<teacher> generate_teachers_struct(
std::vector<std::string> teachers);
void add_teachers_vector_index_number_to_subjects_struct(
std::vector<teacher> &teachers,
std::vector<subject> &subjects);
void process_students_and_generate_results(
std::vector<student> &students,
std::vector<subject> &subjects,
std::vector<teacher> &teachers);
void write_results_to_output_file(
std::vector<student> &students, std::string results_file_name);
int pick_teacher_randomly(std::vector<int> teachers_codes);
std::string return_grade_for_float(float percentage);