I need help on Student record prog

This is a discussion on I need help on Student record prog within the C Programming forums, part of the General Programming Boards category; Hi all, I have a program that I need help on. I have attatched it to this thread-it is a ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    6

    I need help on Student record prog

    Hi all,
    I have a program that I need help on. I have attatched it to this thread-it is a Student Record program that is meant to read in details of a student from a binary file -store this data(put it in structure in memory) then allowing the user to input 4 test marks working out the average.
    Then it is worked out whether the student has passed/failed-then the details are written to Passed.txt or Failed.txt.
    Thanx, much appreciated.
    Attached Files Attached Files
    Last edited by Hursh; 01-18-2002 at 05:50 AM.

  2. #2
    B26354 Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    I won't give up all the answers, but here's a biggie:

    Code:
    typedef struct {
     
    STUDENTSlist[RECORDS];
     
    int GetStudentRecord(void);              /* Reads list from file */
    int EnterandCalcResults(void);           /* Enters marks & calculates results */
    int find(char*,int);                   /* Searches list for entry */
    void WriteToTextFile(int);             /* writes updated list to file */
    You begin defining a structure, but forget to actually "complete the thought" before you move on to your prototypes. Also, STUDENTSlist appears to be an array, but an array of what?

    Good luck.
    Jason Deckard

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    6
    Thanx for your reply Deckard, well its a question of whether I need an array for the records.
    Right here is the whole program - any input will be HIGHLY praised-please before the end of today-I will be forever in debt to you........

    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <alloc.h>

    #define FILE_IN"Students.dat"
    #define FILE_OUT"Passed.txt"
    #define FILE_OUT2"Failed.txt"
    #define RECORDS 25

    typedef struct {
    char Fname[32]--------details of chars--------------- ;
    int ID[7]-------;
    }STUDENTS;

    STUDENTS list[RECORDS];

    int GetStudentRecord(void);
    int Enter&CalcResults(void);
    int find(char*,int);
    void WriteToTextFile(int);

    int GetStudentRecord(void){
    char Fname[32],------------details of chars----------- ;
    int ID[7]-----;
    FILE_IN;

    In=fopen("Students.dat",rb);
    while(students<RECORDS&&(fscanf(in,"%s%s%d%d%s%s%s ",--------chars----------------)!=feof)){
    strcpy(list[],Forename,Fname);
    strcpy(list[],Surname,sname);
    and so on...........for all chars.....

    students++;
    }
    If (in==NULL)
    {
    printf("Can't open file %s\n",FILE_IN);
    exit(EXIT_FAILURE);
    }
    return students;
    }

    int Enter&CalcResults(void){
    int a[N];
    float av = 0;
    int j;
    printf("please enter the test marks\n");
    for (j=0;j<N;j++)
    { printf("Test mark %d = ",j+1);
    scanf("%d",&a[j]);
    av+=a[j];
    }
    av = av/N;
    printf("The test marks were in order- ");
    for (j=0;j<N;j++)
    printf("%6d",a[j]);
    putchar('\n');
    printf("The average mark is %5.3f\n",av);

    char GRADE[1];
    if (av>=0)&&(av<=39) then
    printf("GRADE=E\n");
    ----------and so on to give overall grade----------

    void WriteToTextFile(int){
    FILE *in,*out;
    PERSON stud;
    char buf[RECORDS+1];
    in = fopen(FILE_IN,"rb");
    if (in==NULL)
    {
    printf("

    The rest of the code should write details to appropriate text file-either of two

    CAN ANYBODY HELP ME?????

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Database assignment is Killing me!
    By Boltrig in forum C Programming
    Replies: 2
    Last Post: 11-29-2007, 02:56 AM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. behind and confused
    By steviecrawf in forum C Programming
    Replies: 1
    Last Post: 11-09-2001, 11:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21