FBI - Script started on Thu Apr 14 20:47:27 2005 %cat...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Script started on Thu Apr 14 20:47:27 2005 %cat fbifile.c #include<stdio.h> int readem (FILE *infile,FILE *outfile,int idarr[],double avgarr[]); void printavg (FILE *outfile, int idarr[],double avgarr[],int i); void countem (FILE *outfile,int idarr[], double avgarr[],int i); int main (void){ FILE *infile; FILE *outfile; int idarr[50]; int i; double avgarr[50]; infile=fopen("fbiin","r"); outfile=fopen("fbi.out","w"); i = readem (infile,outfile,idarr,avgarr); printavg(outfile,idarr,avgarr, i); countem (outfile,idarr,avgarr, i); fclose(infile); fclose(outfile); } int readem (FILE *infile,FILE *outfile,int idarr[],double avgarr[]){ int i; int flag; char name[13]; int sum;int j; int temparr[5],max,min; i=0; fprintf(outfile,"NAME ID SCORES "); fprintf(outfile," MAX MIN AVG\n"); flag=0; flag= fscanf(infile,"%s",name); while (flag != -1){ fprintf(outfile,"%-12s",name); flag=fscanf(infile,"%d",&idarr[i]); for (j=0;j<5;j++) flag=fscanf(infile,"%d",&temparr[j]); fprintf(outfile,"%4d",idarr[i]); for (j=0;j<5;j++)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/01/2011 for the course CSC 1253 taught by Professor Staff during the Fall '08 term at LSU.

Page1 / 3

FBI - Script started on Thu Apr 14 20:47:27 2005 %cat...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online