Grading program problems

I have been trying to complete this program for weeks, and I could not complete it. On the output text file, it isn't outputting anything.

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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <fstream>
#include <string>
using namespace std;

char answer[20];
char student[20];
char id[8];
int tGrade[5];
char lGrade [5];

char espace;

void aEntry(char answer[]);
void sEntry (char id[], char student[], char espace);
void sEval (char student[], char answer[]);
void print (char id[], char student[], int tGrade[], char grade[]);

int main()
{
	ifstream in;
	ofstream out;
	
	in.open("input.txt");
	out.open("output.txt");
 	
 	aEntry (answer);
	sEntry (id, student, espace);
	sEval (student, answer);
	print(id, student, tGrade, lGrade);

	in.close();
	out.close();
	
	system("pause");
	return 0; 	
}

void aEntry(char answer[])
{
	ifstream in;
	ofstream out;
	
	int i; 
	for (i=1; i < 21; i++) //May be modified
	{	
		in >> answer[i];
	}
}
void sEntry (char id[], char student[], char espace)
{	
	 ifstream in;
	 ofstream out;
	 
	 int i;
	 int k;
	 for (k=0;k < 6; k++ )
	 { 	 
		 for (i=0; i <= 8; i++)
		 {	 
			in >> id[i];
		 } 
		 
		 in >> espace;
		 
		 for (i=0; i<21; i++)
		 {
		 	in >> student[i];
		 }
	 }
	 }
void sEval(char student[], char answer[])
{
	int points;
	int i;
	int k;
	for (i=0; i < 150; i++)
	{
		for (k=0; k <21; k++)
		{	
			if (answer[k] == student[k])
			   points += 2;
	 		else if (answer[k] != student[k])
			   points -= 1;
			else if (student[k] == ' ')
			   points += 0;	     
		}
		tGrade[k] = points / 40;
	}
	for (i=0; i < 150; i++)
	{
		if (tGrade[i] <= 100 && tGrade[i] >= 90)
		   lGrade[i] == 'A';
 		if (tGrade[i] <= 89.99 && tGrade[i] >= 80)
		   lGrade[i] == 'B';
  		if (tGrade[i] <= 79.99 && tGrade[i] >= 70)
		   lGrade[i] == 'C';
  		if (tGrade[i] <= 69.99 && tGrade[i] >= 60)
		   lGrade[i] == 'D';
  		if (tGrade[i] <= 59.99 )
		   lGrade[i] == 'F';
	}
}
void print (char id[], char student[], int tGrade[], char grade[])
{
	ifstream in;
	ofstream out;
	
	int i;
	for (int i=0; i < 6; i++)
	{	
		out << id[i] << "\t" << student[i]<< "\t";
		out << tGrade[i]<< "%" << lGrade[i];
	}
}
1
2
3
4
5
6
7
8
	ofstream out;

	int i;
	for (int i=0; i < 6; i++)
	{
		out << id[i] << "\t" << student[i]<< "\t";
		out << tGrade[i]<< "%" << lGrade[i];
	}

out is uninitialized file stream. that means it is not associated with any file and you cannot write in it.
You can initialize out like this:
 
ofstream out("file.txt");
Topic archived. No new replies allowed.