We are tasked to calculate the CFRS (computed final raw score) and letter grade of a student or students by reading a text file and producing the output through another text file.

The formula for getting the CFRS is
CFRS = ((classStanding * .40) + CFRS = ((classStanding*.40) + (prelimExam*.10) + (midtermExam*.20) + (prefinalExam*.10) + (finalExam*.20));

A sample input could be like this:

Pedro H. Washington
201010198
Programming 1
65 78 33 46 35

Zeike D. Conan
201010198
Web Programming
34 56 -45 78 100

Ellen Q. Doley
201024567
Data Structures
76 77 80 35 100

James Y. Lamar
201045671
Philosophy 1
98 100 89 99 97

and a sample output is like this:

Pedro H. Washington
201010198
Programming 1
CFRS: 52

Zeike D. Conan
201010198
Web Programming

Ellen Q. Doley
201024567
Data Structures
CFRS: 86

James Y. Lamar
201045671
Philosophy 1
CFRS: 98

Now here's my code for this:

Code:
```#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>

using namespace std;

double CFRS;

struct student{
string fullName;
string idNumber;
string subjectName;
double classStanding;
double prelimExam;
double midtermExam;
double prefinalExam;
double finalExam;

};

double getCFRS(double a, double b, double c, double d, double e){
CFRS = ((a*.40) + (b*.10) + (c*.20) + (d*.10) + (e*.20));

return CFRS;
}

if((CFRS>95)&&(CFRS<=100))
else if((CFRS>90)&&(CFRS<=95))
else if((CFRS>80)&&(CFRS<=90))
else if((CFRS>70)&&(CFRS<=80))
else if((CFRS>60)&&(CFRS<=70))
else
}

int main(){

student data;
int ctr = 0, i, k;
string blank;
vector <student> record;
ifstream gin;
ofstream gout;

gin.open("students.in.cpp");
gout.open("students.out.cpp");

if ((gin.is_open())&&(gout.is_open())){

while (!gin.eof()){
getline (gin, data.fullName);
getline (gin, data.idNumber);
getline (gin, data.subjectName);

while (chop >> data.classStanding >> data.prelimExam >> data.midtermExam >> data.prefinalExam >> data.finalExam)
getline (gin, blank);
record.push_back(data);
}
for (i = 0; i < record.size(); i++){
gout << record[i].fullName << endl;
gout << record[i].idNumber << endl;
gout << record[i].subjectName << endl;

for (k = i + 1; k < record.size(); k++){
if (record[i].idNumber == record[k].idNumber){
ctr++;
k = record.size();
}
}
if ((record[i].classStanding<0)||(record[i].classStanding>100)||(record[i].prelimExam<0)||(record[i].prelimExam>100)||
(record[i].midtermExam<0)||(record[i].midtermExam>100)||(record[i].prefinalExam<0)||(record[i].prefinalExam>100)||
(record[i].finalExam<0)||(record[i].finalExam>100)){
gout << "ALERT: There is an invalid grade for this particular student. NOTE: Grades must be 0 to 100 only." << endl << endl;
}
else{

gout << "CFRS: " << getCFRS(record[i].classStanding,record[i].prelimExam,record[i].midtermExam,
record[i].prefinalExam,record[i].finalExam) << endl;
}
}
gout << "Number of Students on this List: " << record.size() - ctr << endl;
}
else
cout << "Error opening file(s). Please check the filename of the textfile." << endl;

gin.close();
gout.close();

system("PAUSE");
return 0;
}```

My problem is, when it comes to the negative integers. It does prints the alert message but the succeeding students who doesn't have any negative grades also post an alert message. It looks like this:

Pedro H. Washington
201010198
Programming 1
CFRS: 52

Zeike D. Conan
201010198
Web Programming

Ellen Q. Doley
201024567
Data Structures

James Y. Lamar
201045671
Philosophy 1

NOTE: we can't use classes, only structures.

How can I solve this problem guys? I would appreciate any help. Thanks!

2. Life++ ... you should do some forum searches, you will find half a dozen student grade threads already posted and I'm sure there's information there that will help...

3. The problem with that code is that getLetterGrade (double CFRS) doesn't return anything.
Code:
```string getLetterGrade (double CFRS){