O/I Streams an arrays/functions

I am trying the get the program to create a .txt file and then input text to that file after using arrays. The output to the file should be something like this:

Student ID: 1 (Position im guessing on file)
Student Name: name
Lab Average:
Exam Average:
Homework Average:
Project:
Final Weighted Score:
Final Grade:

I have the following code:

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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include <cstdlib>
#include <fstream>

using namespace std;

// Function declarations
void gradeResult(ifstream& in_file, ofstream& out_file, int labPercent, int examPercent, int
hwPercent, int projPercent);
double average(int Scores[], int size);
char grade(double final_score);
void highest_scorer(double total, double& total_High, string name, string& High_name);
void lowest_scorer(double total, double& total_Low, string name, string& Low_name);


int main()
{
    ofstream out_file;
    ifstream in_file;
    in_file.open("Score.txt"); // opens file
    out_file.open("EECS138score.txt"); // opens file
    if (in_file.fail()) // if file is not found, this will be displayed
    {
        cout << "Failed to open file." << endl;
        exit(1);
    }

    string filename;

    cout << "Please enter the name of your output file:" << endl;
    cin >> filename;
    gradeResult(in_file, out_file, 15, 40, 25, 20);
    cout << "Reading from input files." << endl;
    cout << "Your output file has been created and the computation results have been stored there." << endl;
}

// Function definitions
void gradeResult(ifstream& in_file, ofstream& out_file, int labPercent, int examPercent, int
hwPercent, int projPercent)
{
while(!in_file.eof())
{
    string name;
    in_file >> name;
    int lab[5];
    in_file >> lab[0];
    in_file >> lab[1];
    in_file >> lab[2];
    in_file >> lab[3];
    in_file >> lab[4];
    int exam[2];
    in_file >> exam[5];
    in_file >> exam[6];
    int homework[3];
    in_file >> homework[7];
    in_file >> homework[8];
    in_file >> homework[9];
    int project[1];
    in_file >> project[10];

}
}
/*double average(int Scores[], int size)
{

}
char grade(double final_score)
{

}
void highest_scorer(double total, double& total_High, string name, string& High_name)
{

}
void lowest_scorer(double total, double& total_Low, string name, string& Low_name)
{

}
*/


The text file looks like this:

John 100 100 90 95 85 100 90 100 100 98 75
Tom 90 92 82 95 89 93 95 97 96 98 92
Shannon 100 90 95 85 100 65 75 95 100 90 60
Matt 98 90 95 85 100 90 90 95 100 90 82
Steve 100 100 90 95 85 75 85 90 95 100 78
Nicole 90 90 95 100 75 100 100 90 92 82 68

I am kind of lost from here. I was working on the gradeResult function definition but am not sure where to go from here... any help would be greatly appreciated.
Topic archived. No new replies allowed.