grade calculator. need assistance.

Can someone help me revise this program?
it's not working out right, it'll work the first time, but won't let me input the 2nd data set

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
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
using namespace std;

const int NUMHOMEWORK = 7; //use to control bitmap loop
const int NUMPROGRAMS = 4; //use to control program loop
const float MAXPROGRAMS = 400.0;
const char ASCIICONVERT = 0X0F;
const int numvalue = NUMHOMEWORK - 1;

int main()
{
ifstream inFile;
inFile.open("grades.txt");

int finalExam, homework, program; //declaring 'final exam', 'hourly exams', 'homework'
//and 'programs' as an integer
int hourlyExam1, hourlyExam2, hourlyExam3;
char letterGrade; //declaring 'letterGrade' as a character
int hourlyExamCount; //hourlyExamCount as an int, used in 'for loop'
int programCount; //count control loop for the program for loop
int sumExams = 0;
int sumPrograms = 0;
float finalGrade;
int lowestExam;
int numvalue;

cout << setw(10) << "Final Exam";
cout << setw(18) << "Three Hourly Exams";
cout << setw(8) << "Homework";
cout << setw(8) << "Programs";


while (inFile)
{
cout << endl;
//Final Exam
inFile >> finalExam; //taking the first set of number as the final exam
cout << finalExam << endl;
cout << endl;

//3 Hourly Exams
inFile >> hourlyExam1;
inFile >> hourlyExam2;
inFile >> hourlyExam3;
if (hourlyExam1 < hourlyExam2 || hourlyExam1 < hourlyExam3)
hourlyExam1 = lowestExam;
else if (hourlyExam2 < hourlyExam1 || hourlyExam2 < hourlyExam3)
hourlyExam2 = lowestExam;
else
hourlyExam3 = lowestExam;

sumExams = hourlyExam1 + hourlyExam2 + hourlyExam3 - lowestExam;

//the homeworks
inFile >> homework;
while (homework < NUMHOMEWORK)
{
if (homework = true)
{
homework = homework + 1;
homework++;
}
else if (homework = false)
{
homework = homework + 0;
}
}
homework = numvalue;

//4 Programs
inFile >> program;
for (programCount = 0; programCount <= 3; programCount++)
{
cout << "Program grades are: " << program << endl;
sumPrograms = sumPrograms + program;
inFile >> program;
}
cout << "The sum of the programs is " << sumPrograms << "." << endl;
cout << endl;





//Grading Scale
cout << "Letter Grade is ";
if (finalGrade >= 90)
cout << "A." << endl;
else if (finalGrade >= 80)
cout << "B." << endl;
else if (finalGrade >= 70)
cout << "C." << endl;
else if (finalGrade >= 60)
cout << "D." << endl;
else if (finalGrade >= 50)
cout << "E." << endl;
else
cout << "F for failing." << endl;

}

system("pause");
return 0;
}
Last edited on
Topic archived. No new replies allowed.