I have an input files with chars (grades) in it and am trying to input them into an array using functions and input files. I don't beleive I am declaring / passing the input file (iFile) correctly. Any help with my sytax and parameters would be great.
Error(s): 'std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]' is private
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
void readInput(char gradeArray[][3], ifstream iFile);
void spitOutpt(char gradeArray[][3], ifstream iFile);
int main()
{
ifstream iFile;
iFile.open("grades.txt");
char gradeArray[5][3];
readInput(gradeArray, iFile);
spitOutpt(gradeArray, iFile);
return 0;
}
void readInput(char gradeArray[][3], ifstream iFile)
{
for(int r = 0; r < 5; r++)
{
for(int c = 0; c < 3; c++)
{
iFile >> gradeArray[r][c];
}
}
return;
}
void spitOutpt(char gradeArray[][3], ifstream iFile)
{
cout << "All Grades" << endl;
cout << left << setw(10) << "Student";
cout << left << setw(10) << "English";
cout << left << setw(10) << "History";
cout << left << setw(10) << "Math";
cout << endl;
for(int r = 0; r < 5; r++)
{
cout << "#" << left << setw(10) << r;
for(int c = 0; c < 3; c++)
{
cout << left << setw(10) << gradeArray[r][c];
}
cout << endl;
}
return;
}