Stuck and Need Guidance :^(

When I run my program I get the following two errors:

1. IntelliSense: more than one instance of overloaded function "Process_Data" matches the argument list:

2. error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'


I've encountered error c2248 before and fixed it using pass-by references but that doesn't work with the structure. Any help or guidance in the right direction would be awesome! :^)

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
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#define Size 20

using namespace std;

struct Stud{
	string Name;
	long ID;
	float GPA, SPoints;
	int SUnits;
	char Grade;
};

struct PStud{
	Stud list[Size];
};

void Process_Data(ifstream, Stud[], PStud &, int &);
float Assign_GPA(char);
void Process(int, float, float &, int &);
bool Verify(int);
bool Open_File(ifstream &);
bool Open_File2(ofstream &);

int main()
{
	Stud TEMP[Size];
	PStud Stud;
	string Name, FName;
	ifstream Input;
	ofstream Output;
	int Num = 0;
	int counter = 0, SUnits = 0, Tot_Units = 0;
	float SPoints = 0, Tot_Points = 0, Tot_GPA;

	if (Open_File(Input))
	{
		if (Open_File2(Output))
		{
			Output << setprecision(2) << fixed << showpoint;
			cout << left << setw(27) << cout << left<<setw(27)<<"\n\nStudent Name" << setw(10)<<"ID "<<setw(10)<<"Units" <<setw(8)<<"GPA" <<endl;
			cout <<"====================================================\n";
			Output << left<<setw(27)<<"\n\nStudent Name" << setw(10)<<"ID "<<setw(10)<<"Units" <<setw(8)<<"GPA" <<endl;
			Output <<"====================================================\n";
			getline(Input,TEMP[Num].Name);
			while(!Input.eof())
			{
				Input >> TEMP[Num].ID;
				Process_Data(Input, TEMP, Stud, Num);
				cout << setw(25) << Name << setw(10) << TEMP[Num].ID << setw(10) << TEMP[Num].SUnits << setw(8) << TEMP[Num].GPA <<endl;
				Output << setprecision(2)<<fixed;
				Output << setw(25) << Name << setw(10) << TEMP[Num].ID << setw(10) << TEMP[Num].SUnits << setw(8) << TEMP[Num].GPA <<endl;
				counter++ ;
				Input.ignore(10,'\n');
				getline(Input,Name);
			}
			Tot_GPA = Tot_Points / Tot_Units;
			cout <<"==================================================\n";
			cout <<"Group of "<<counter<<setw(25)<<" Students Totals" <<setw(10)<< Tot_Units << setw(10)<< Tot_GPA  << endl << endl ; 
			Output <<"==================================================\n\n";
			Output <<"Group of "<<counter<<setw(25)<<" Students Totals" <<setw(10)<< Tot_GPA << setw(10)<< Tot_GPA  << endl << endl ; 
			cout << endl << endl ;
		}
	}
	return 0;
}


My functions are:
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
void Process_Data(ifstream &Input, Stud temp[], PStud &list, int &Num){
	float GPA, Points, SPoints = 0, Tot_Points;
	int Units, SUnits = 0, Tot_Units;
	char Grade;
	Input >> Grade;
	while(Grade != '*')
	{
		Input >> Units;
		Points = Assign_GPA(Grade);
		Process(Units, Points, SPoints, SUnits);
		Input >> Grade;
	}
	temp[Num].SUnits += SUnits;
	temp[Num].SPoints += SPoints;
	if (temp[Num].SUnits > 0)
	{
		temp[Num].GPA = temp[Num].SPoints/temp[Num].SUnits;
		Num++;
	}
}

float Assign_GPA(char Grade)
{
	float score;
	if (Grade == 'A' || Grade == 'a')
		score = 4.0;
	else if(Grade == 'B' || Grade == 'b')
		score = 3.0;
	else if(Grade == 'C' || Grade == 'c')
		score = 2.0;
	else if(Grade == 'D' || Grade == 'd')
		score = 1.0;
	else if(Grade == 'F' || Grade == 'f')
		score = 0.0;
	else
		score = -1;
	return score;
}

void Process(int Units, float Points, float &SPoints, int &SUnits)
{
	if (Verify(Units) && Points >= 0)
	{
		SPoints += Points*Units;
		SUnits += Units;
	}

}

bool Verify(int Units)
{
	if (Units > 0 && Units <=5)
		return true;
	else
		return false;
}

bool Open_File(ifstream &Input)
{
	int counter = 0;
	string FName;
	do{
		counter++;
		Input.clear();
		cout << "Enter the input file name: ";
		getline(cin, FName);
		Input.open(FName.c_str());
	}while (Input.fail() && counter < 3);
	if (counter > 3)
	{
		cout <<"Bad file name.\nProgram Terminated.\n\n";
		return false;
	}
	return true;
}

bool Open_File2 (ofstream &Output)
{
	int counter = 0;
	string FName;
	do{
		Output.clear();
		cout << "Enter the output file name: ";
		getline(cin, FName);
		Output.open (FName.c_str());
	}while (Output.fail() && counter < 3);
	if (counter > 3)
	{
		cout << "Bad file name.\nProgram Terminated.\n\n";
		return false;
	}
	return true;
}
Line 21 in your main program:

void Process_Data(ifstream, Stud[], PStud &, int &);

You forgot the & after the ifstream so the compiler thinks you have a different function defined than what you meant.
1) Your prototypes don't match
2) You can't copy an fstream. Pass it by reference instead.

Don't loop on eof(), it will stop too late. Loop against the read action.
Thanks for the help :^)
Topic archived. No new replies allowed.