Jump to content

student grading system

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
archriku

archriku

    Newbie

  • Members
  • Pip
  • 1 posts
#include <stdio.h>


#define TRUE 1

#define FALSE 0



typedef struct {

   char student[30];	

   int q1;

   int q2;

   int q3;

   int proj;

   int mid;

   int final;

   int total;

} Record;


Record records[10];


FILE *ptin, *ptout;


int main(void)

{

   int i, j, trash, flag = TRUE;      

   char line[90];

   char header[90];  

   ptin = fopen("studentsmark.txt", "rt");

   ptout = fopen("studentresult.txt", "wt");


   if(ptin == NULL || ptout == NULL) {

       printf("\nError opening files! \n");

       return 1;

   }

	

    fgets(line, 88, ptin);        

    fgets(header, 88, ptin);      


   flag = TRUE;

   i = 0;

   while (flag > 0) {

      flag = fscanf(ptin, "%d %s %d %d %d %d %d %d",&trash, records[i].student, &records[i].q1, 

      &records[i].q2, &records[i].q3, &records[i].proj, &records[i].mid, &records[i].final);

      

      fprintf("\n%d %s %d %d %d %d %d %d\n", trash, records[i].student, records[i].q1, records[i].

      q2,records[i].q3, records[i].proj, records[i].mid, records[i].final);

     ++i;

  }


   /*for(j = 0; j < i-1; j++)  {

      printf("\n%s %d %d %d %d %d %d\n", records[j].student, records[j].q1,records[j].q2,

      records[j].q3, records[j].proj, records[j].mid, records[j].final);

   }


   

  

   for(i = 0; i < 10; i++)  {

      records[i].total =  records[i].q1 + records[i].q2 + records[i].q3 + records[i].mid + records[i].final; 

   }*/

   

   fclose(ptin);

   fclose(ptout);


  

}

help plz my outputfile is empty

Attached Files



#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Are you sure you are getting into your while loop?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
passenger

passenger

    Newbie

  • Members
  • Pip
  • 6 posts
what kind of grading system it is