Thread: I need help!?!?!?!?!

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    2

    Question I need help!?!?!?!?!

    A sequential access file "grades.txt" contains student records. A student record has 11 datafields which are NUMBER, FIRST_NAME, LAST_NAME, QUIZ1, QUIZ2, MIDTERM1,MIDTERM2, HOMEWORK, FINAL, AVERAGE and LETTER_GRADE for each student.

    You should write two functions: main and WriteToFile.WriteToFile function should take two arguments: a student structure and a pointer to a file.The function should write the NUMBER, FIRST_NAME, LAST_NAME, AVERAGE andLETTER_GRADE of the students to the file.

    The participation of the grades to the average are defined as: QUIZ1 (%10), QUIZ2 (%10),MIDTERM1 (15%), MIDTERM2 (15%), HOMEWORK (10), FINAL (%40).

    You should then assign the letter grades based on the average grades:

    Average Letter Grade
    [85-100] A
    [70-85) B
    [55-70) C
    [40-55) D
    [0-40) F


    Before the main function:
    1. Define a structure STUDENT which has 11 data fields: NUMBER, FIRST_NAME,LAST_NAME, QUIZ1, QUIZ2, MIDTERM1, MIDTERM2, HOMEWORK, FINAL,AVERAGE and LETTER_GRADE.


    In function main:
    1. Declare an array of structure with 80 elements.
    2. Open the file “grades.txt” for reading.
    3. Open two files named “pass.txt” and “fail.txt” for writing.
    4. Read the elements of each student from “grades.txt” until you reach the end of file.
    5. Calculate the average grade of each student
    6. Determine the letter grade of each student.
    7. Call the function WriteToFile for each student with a pointer to the file “fail.txt” if thestudent fails or “pass.txt” if the student passes.
    8. Close the files.
    9. Print the total number of students in the class.
    10. Print the number of students who had A, B, C, D, and F, respectively.


    In function WriteToFile:
    1. Write the NUMBER, FIRST NAME, LAST NAME, AVERAGE and LETTER GRADEof one student to the specified file.


    Student ID -F.Name- Last Name-Q1-Q2-MT1-MT2-Homework-Final

    00160004005-Semina- Aktuna - 51-71- 82- 76- 94.1- 74
    00160004009-Boran- Hamidi- 85-77- 68- 78- 85.9- 69

    00160009011-Safa- Batga- 16-18- 38- 0- 18.8- 8
    00160009013-Ahmet- Baydar- 73-15- 56- 32- 53.5- 16
    00160009015-Orhun- Batur- 36-13- 18- 9- 63.5- 6
    00160009021-Jutenya- Benan- 6-39- 30- 41- 69.4- 30
    00160009028-Ezel- Bargan- 79-45- 83- 42- 57.6- 50
    00160009029-Nur- Kefal- 6-39- 58- 26- 80.0- 58
    00160009044-Onat- Belge- 68-65- 73- 60- 45.9- 56
    00160009049-Nergiz- Gilim- 98-97- 99- 86- 100.0- 86

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So where is your attempt at a solution?
    https://cboard.cprogramming.com/c-pr...uncements.html
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Tags for this Thread