help beginning programming

I have a homework assignment that I have no idea where to go or what to do next. Could you please help? Thanks!

The assignment reads:

your program is to read from a file students.dat which may contain a list of student names that could contain as many as eleven characters. In addition to the list of names, your program should read four sets of numbers which represent two exams worth 20%, a final exam worth 30%, and homework worth 30%. The student's name and grades is on the first line, with no title lines. Find the weighted average grade for all students. The average grade is to berounded to the nearest integer, not to truncated to an integer. Then, sort the list of students by grade, and assign letter grades to each student. The sorting can be a selection or a bubble sort, and is to be done in function sub-program. Say also if the student passes or fails. Put the sorted list into a file called outstu.dat. Put a two line title above the output.

The grade distribution is

85-100 A

70-84 B

55-69 C

40-54 D

0-39 F

This is what i have so far:

Code:

/* Homework 12 */

#include FILENAME "students.dat"

#include <stdio.h>

#include <math.h>

#include <string.h>

struct record

{

char name[12];

int ex1, ex2, final, hw, ave, grade passf1[5];

};

int main(void)

{

struct record s[50];

int nos, i=0;

FILE *students;

{

while (fscanf(students, "%s %i %i %i %i," s[i].name, s[i].ex1, s[i].ex2, s[i].final, s[i].hw)==5)

++i;

s[i].ave=s[i].ex1*0.2+s[i].ex2*0.2+s[i].final*0.3+s[i].hw*0.3;

if(s[i].ave>=85) s[i].grade='A';

if(s[i].ave>=70) s[i].grade='B';

if(s[i].ave>=55) s[i].grade='C';

if(s[i].ave>=40) s[i].grade='D';

if(s[i].ave>=0) s[i].grade='F';

if(s[i].ave>=40)

strcpy(s[i].passf1, "pass");

else strcpy(s[i].pass1, "fail");

sort(s, nos);

for(i=0, i<nos, ++i);

fprintf(outf, "%-11s %5i %5i %5i %5i %5i %c %4sh," s[i].name, s[i].ex1, s[i].ex2, s[i].final,

s[i].hw)

void sort(record s[], int n);

int k,l m;

record hold;

for(k=0, k<=2, ++k);

m=k;

for(i=k+1, j<=n);

if(s[j] < x[m], ave);

m=j;

hold=x[m];

x[m]=x[k];

x[k]=hold;