infile

ATTENTION PROGRAMMERS!!!

I’m struggling with this problem, can anyone help with me code this one in C++? So I’m calling the attention of the next Steve Jobs or Bill Gates, it could be you! I’m a computer enthusiast but a beginner and lacks knowledge in C++ programming. I terribly need it before March 18,2013, Monday(Philippine time). Please reply me to my email address: deocollao@yahoo.com

Project Name: Student Scores
Source file name: studentscores.cpp
Input file name: scores.in
Output file name: scores.out

Write a program that reads student’s names (lastname, firstname) followed by their test scores. The program should output each student’s name followed by their test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest score.
Student data should be stored be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Use the A-F grading scheme. Suppose that the class has 20 students, use an array of 20 components of type studentType.
Your program must contain at least the following functions:
a. A function to read the student’s data into the array.
b. A function to assign the relevant grade to each student.
c. A function to find the highest test score.
d. A function to print the names of the students having the highest test score.
Your program must output each student’s name in this form: last name followed by a comma, followed by the first name. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.
Yes, next Bill Gates will be glad do make a simple homework for free.

This is not a homework site. We will be glad to help you with problems you encountered, but we will not do your homewor for you. Post your code, tell us what problems do you have...
Sorry for that... actually I have started to code unfortunately I cannot advance... because as I've said lately I'm a beginner and I'm still coping with the programming environment...Here's the code I've started:


#include<stdio.h>
#include<string.h>
#include<fstream>



/*struct studentType{
string studentFName;
string studentLName;

int testScore;
char grade;
};*/

//function
int equivalent(int);




//main function
main(void){
int testScore;

FILE *fp;
int grade;
/*file to be opened here*/
if((fp=fopen("scores.in", "r"))==NULL)
{
printf("Cannot open directory file!\n");
exit(1);}

while(1){ int x=3;

/*data to be opened here*/
for(x;x>0;x--){
fscanf(fp, "%i", &testScore);
if(feof(fp))
break; }

/*logic here*/
while(x>0){
equivalent(testScore);
x--; }

}


}


//equivalent letter grade
int equivalent(int grade){


if(grade>=99 && grade<=100){
char eg[9]="A++";}
else if(grade>=96 && grade<=98){
char eg[9]="A+";}
else if(grade>=93 && grade<=95){
char eg[9]="A";}
else if(grade>=89 && grade<=92){
char eg[9]="A-";}
else if(grade>=86 && grade<=88){
char eg[9]="B+";}
else if(grade>=83 && grade<=85){
char eg[9]="B";}
else if(grade>=79 && grade<=82){
char eg[9]="B-";}
else if(grade>=76 && grade<=78){
char eg[9]="C+";}
else if(grade>=73 && grade<=75){
char eg[9]="C";}
else if(grade>=69 && grade<=72){
char eg[9]="C-";}
else if(grade>=64 && grade<=68){
char eg[9]="D+";}
else if(grade>=63 && grade<=65){
char eg[9]="D";}
else if(grade>=56 && grade<=62){
char eg[9]="D-";}
else {
char eg[9]="F";}

char eg[9];
printf("%9s\n\n",eg);

system("pause");
}


I would be very grateful if you could help me with.......a small help would be very much appreciated..thank you very much
Last edited on
Topic archived. No new replies allowed.