Create a program that will calculate the CFRS and the letter grade equivalent of a list students using an array of structures. your inputfile:"students.in" and your outputfile must be:"students.out".im confused in filestreaming.

my specifications.
Student as the name of my structure.
Student_List as my array of structure.

my structure named Student has my own member variables:
fullName[string]-name of the student
idNumber[string]-id number of the student
subjectName[string]-the name of the subject taken

*the grades must only accept values from 0 - 100

To calculate the CFRS of apply the following formula.

CFRS = (classStanding * .40) + (prelimExam *.10) + (midtermExam * .20) + (prefinalExam * .10) + (finalExam *.20)

the letter grade of the student.
96-100 = "A" 91-95 = "B+" 81-90 = "B" 71-80 = "C" 61-70 = "D" 60 below="F"

INPUT: A list of students with their full name, ID number, The Title of the subject, and the grades for their class standin, prelim exam, midterm exam, prefinal exam, final exam respectively.
OUTPUT: The List students with their ID number, fullName, CFRS and the letter grade.

I saw this problem from a book. And I want to solve this but Im not expert at filestreaming. Im new to it.Can you give the full codes of these and I will analyze the whole code and learn from it.I'm trying it 2 days but I can't. There's so many error.Be my teacher and I will be your student. Im glad to learn from you.I'm only a beginner.can you give me as soon as possible because I'm very confused and excited to learn from it. can you do it now teacher? tnx :))

Such an epic'ly bad attempt at coaxing us to do your homework.

here's my code.. make a corrections.. i just want to solve this.

``````#include <iostream>
#include <fstream>
#include <string>

using namespace std;

struct Student {
string fullName , idNumber , subjectName;
double classStanding , prelimExam , midtermExam , prefinalExam, finalExam;
};

void output(Student, Student , Student);
double process(Student , Student , Student , Student , Student, double , string);
int main()
{
Student Student_List[20];
ifstream inputfile("students.in");

if(!inputfile)
{
cout << "File could not be opened" << endl;
return 1;
}
int x = 0;
double CFRS;

while (!inputfile.eof()){
inputfile >> Student_List[x].fullName >> Student_List[x].idNumber >> Student_List[x].subjectName;
output(Student_List[x].fullName, Student_List[x].idNumber , Student_List[x].subjectName);
inputfile >> Student_List[x].classStanding >> Student_List[x].prelimExam >> Student_List[x].midtermExam
>> Student_List[x].prefinalExam >> Student_List[x].finalExam;
process(Student_List[x].classStanding , Student_List[x].prelimExam , Student_List[x].midtermExam
, Student_List[x].prefinalExam , Student_List[x].finalExam , CFRS , letterGrade);

void output (Student x , Student y, Student z){
cout << x << endl;
cout << y << endl;
cout << z << endl;
}
double process (Student a, Student b, Student c, Student d, Student e, double CFRS , string letterGrade){
if( a < 0 || a > 100 || b < 0 || b > 100 || c < 0 || c > 100 || d < 0 || d > 100 || e < 0 || e > 100)
cout << "There is an invalid grade in your input" << endl;
else{
CFRS = (a * .40) + ( b * .10) + (c * .20) + (d * .10) + (e *.20);
if (CFRS >= 96)
letter = "A";
else if (CFRS >= 91)
letter = "B+";
else if (CFRS >= 81)
letter = "B";
else if (CFRS >= 71)
letter ="C";
else if (CFRS >= 61)
letter = "D";
else
letter = "F";
}

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

line 45 and 48: a, b, c, d and e are structures and you can not compare structures like that (unless you code in some operator overloads which I don't think you are ready to do yet). In the student structure which of the several double values are you trying to compare? You will have to fix this problem with something like this `if( a.prelimExam < 0 || a.prelimExam > 100 || a.midtermExam < 0 || a.midtermExam > 100 || ...)`

it says that conversion from std string to nonscalar type student requested.what's the correct code?

The function process() is all warong anyway. Go back to the requirements you posted and see how CFRS us syooised to be calculated. It is the sum of the individual double variables for only one student, not for four students. I think the function should be like this: It should return to the caller the letter grade and CFRS for just one student. The functdion should be called in a loop for each student

``````double process (Student a, char& letterGrade)
{

}``````

One thing I'd suggest, just from skimming the code, is to try to let your functions only deal with one student at a time unless you're comparing the two students. There's no need to plug 5 student objects into a function at once, and would look much cleaner and be easier to manage if you just used a loop for one student at a time.

On second examination you're calling your "process" function with prototyped Student variables yet you're giving it the member variables:

``process(Student_List[x].classStanding , Student_List[x].prelimExam , Student_List[x].midtermExam``

You're giving the function double variables when you told it to expect student variables. You need to either just take in one student variable and grab the members from there (You'll then need to use a reference to grab the student to ensure it doesn't go out of range), or you'll need make those student variables "double" variables. Even then, you'll still need to reference them to make sure they don't go out of range. Or, you can could have process return the CFRS, then you wouldn't need to reference anything. Like this:

``double Process(student)``

Then, you can call it like this:

``Student_List[x].CFRS = Process(Student_List[x]);``

There may be other problems but let's get those figured out first, since their the most obvious.