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
|
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
struct studentType
{
string studentFName;
string studentLName;
int testScore;
char grade;
};
studentType students[20];
ifstream studentDataInput;
ofstream studentDataOutput;
void inputData(int, studentType students[], ifstream&);
void letterGrade(int, studentType students[], char&);
void printstudentData(int, studentType students[]);
void highestScore(int, studentType students[], int);
void highestGrades(int, studentType students[], ofstream&);
int main()
{
int i = 0;
int highScore = 0;
studentDataInput.open("StudentDataInput.txt");
studentDataOutput.open("StudentDataOutput.txt");
inputData(i, students, studentDataInput);
letterGrade(i, students, students[i].grade);
printstudentData(i, students);
highestScore(i, students, highScore);
highestGrades(i, students, studentDataOutput);
system("pause");
return 0;
}
void printstudentData(int j, studentType students[])
{
studentDataOutput << setw(12) << "Student Name" << setw(25) << "Test Score" << setw(15) << "Grade" << endl;
for (j = 0; j < 20; j++)
{
studentDataOutput << students[j].studentLName << ", " << setw(18) << left << students[j].studentFName;
studentDataOutput << setw(20) << left << setfill(' ') << students[j].testScore;
studentDataOutput << setw(5) << students[j].grade << endl;
}
studentDataOutput << endl;
}
|