Programming project help



Hey, I am working on a project where a program has to read in a
collection of exam scores ranging in value from 0 – 100. The program
should count and print the number of outstanding scores (90-100) the
number of satisfactory scores (60-89) the number of unsatisfactory
scores (0-59) and the number of invalid scores (less than 0 or greater
than 100).

The program should print output starting at the top of the page with
your name followed by some column headings to identify the output.
example:
Outstanding Satisfactory Unsatisfactory Invalid
90 89
44 212
98 76
35 -8

This is what I have for my source code so far. But I am having
problems getting the data to display correctly.

#include <stdio.h>

int main(void)
{

// Programmer Jordan Van der Flier
// November 2008

// Categorizes a list of grades, calculates, max, min, and avg


FILE *in; // delcares a file type, assigns name 'in'

int grade;
int max, min, avg;
int count = 0;
int outstanding, satisfactory, unsatisfactory, invalid;

// associates 'in' with file location
in = fopen("i:\\numbers.dat", "r"); // file
location,
"r" means read

fscanf(in, "%d", &grade); // scans from
external source

printf(" Outstanding Satisfactory Unsatisfactory
Invalid ");
printf("\n Grade Grade
Grade Grade");

while(! feof(in)){ // while 'not' at
End Of File

if(90 <= grade && grade <= 100){ // grades
90-100
outstanding = grade;
printf("\n %d", outstanding);
}

else if(60 <= grade && grade <= 89){ // grades
60-89
satisfactory = grade;
printf(" %d", satisfactory);
}

else if(0 <= grade && grade <= 59){ // grades
0-59
unsatisfactory = grade;
printf(" %d", unsatisfactory);

}

else if(0 > grade || grade > 100){ // grades
less than 0 or
greater than 100
invalid = grade;
printf(" %d", invalid);
}

else {}

fscanf(in, "%d", &grade);
}
fclose(in);

return(0);
.



Relevant Pages

  • programming project, revise
    ... number of satisfactory scores the number of unsatisfactory ... int main ... int outstanding, satisfactory, unsatisfactory, invalid; ... outstanding = grade; ...
    (comp.lang.c)
  • Re: Programming project help
    ... should count and print the number of outstanding scores the ... scores and the number of invalid scores (less than 0 or greater ... int main ... outstanding = grade; ...
    (comp.lang.c)
  • Re: An array within a table--Break into 1-to-1 mini tables or separate rows?
    ... multiple rows for keeping the grade values. ... User interface should not drive table structures. ... The reason I kept leaning towards putting the six grade fields into 1 ... Grade_CommunicationRating Int ...
    (microsoft.public.access.tablesdbdesign)
  • Using arrays in C.
    ... the grade. ... int enterInfo ... cin>> Stud_Num; ... cin>> response1; ...
    (comp.lang.c)
  • Re: Help me with a class assignment
    ... This file will consist of the component functions ... prog4Fns.h would have been a better name for the header file. ... int get_grades; ... int index, invalid, sum; ...
    (comp.lang.c)