I'm trying to make a program that will read two txt files, with GPA information (one for females and one for males) arranged like this:
M 4.0
M 3.7
M 2.9
I've been instructed to used pass by reference void functions with no global variables. My major issue is how do I make a function to open the files then another to initialize variables? Here's what I've got so far, it's pretty rough.
If some one can even just explain conceptually how to do something like this, that would be great.
//GPA.cpp
//CMP-110
//October 09'
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
//Function Prototypes
void openFiles(
void initialize(
void sumGrades(
void averageGrades(
void printGrades(
int main()
{
openFiles()
}
void openFiles(ifstream& gpa)
{
ifstream mData;
ifstream fData;
ofstream outGpa;
mData.open("c:\\maleGPA.txt");
fData.open("c:\\femaleGPA.txt");
outGpa.open("c:\\finalGpa.txt");
outGpa << fixed << showpoint;
outGpa << setprecision(2);
}
void initialize(&)
{
int mCount = 0;
int fCount = 0;
double mGPA = 0.00;
double fGPA = 0.00;
int countFemale = 0;
int countMale = 0;
double sumFemaleGpa = 0.00;
double sumMaleGpa = 0.00;
}
void sumGrades(&)
{