1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int ARRAY_SIZE = 20;
//constexpr int ARRAY_SIZE{ 20 }; // <--- C++11 on updated version.
const enum programType { CSCI, DBMS, INFM, SDEV }; // <--- As a global variable it should be a constant.
struct nameType
{
string firstName;
char middleInitial;
string lastName;
};
struct studentType
{
nameType name; // <--- "name" can hold a first name, middle initial and a last name.
nameType ID; // <--- "ID" can hold a first name, middle initial and a last name. Probably should just be a "std::string". Or could be a numeric variable.
nameType email; // <--- "email" can hold a first name, middle initial and a last name. Probably should just be a "std::string".
int GPA;
programType program;
};
void readClassRoster(ifstream&, studentType[], int&); // <--- As per the TheIdeasMan variable names here do help, but not required.
void readProgramGPA(ifstream&, studentType[], int);
int findStudentByID(int, const studentType[], int);
double findHighestGPA(const studentType[], int);
void printHighestGPA(double, const studentType[], int);
int main() // <--- "main" is empty. Program does nothing.
{
return 0; // <--- Not required, but makes a good break point for testing.
}
void readClassRoster(ifstream&, studentType[], int&) // <--- As per the TheIdeasMan needs variable names.
{
ifstream in; // <--- Why pass a file stream if you are going to open a new one?
in.open("classroster.txt");
// <--- Need to check if the file is open and usable.
for (int i = 0; i < ARRAY_SIZE; i++)
{
}
}
|