Thread: C program for reading text files and calculating and store in another file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2017
    Posts
    2

    C program for reading text files and calculating and store in another file

    how to program this one
    Usage of Arrays, Functions and Files
    Students are expected to write, compile, run and test a complete C program to evaluate multiple-choice examination results of the students. For that purpose, three text files are provided involving student’s information, answers, and the solution key. Solution key ‘booklet.txt’ contains three rows containing correct answers for three different booklet types, namely, A, B, and C. Student’s answers are given in ‘answers.txt’. Student’s departmental information is given in ‘students.txt’. The program shall read all three files and produce a new file called ‘results.txt’ containing the results in the given format.
    ‘booklet.txt’ content looks like below (each booklet type has 50 correct answers)
    ACBAA*DBC*DDAACDBACCABDCABCCBDDABC*CABABABCBD*AABD



    ‘answers.txt’ content looks like below (* means unanswered)
    117429 A DBA*DCACBACDBABDCABBCADACCBBDDAABC*CABABCDBDC*AABD
    124259 B D*DBCBAAC*CBACBBDA*BDA*CCABAACDBABBCAADD*CBD*AABCA

    ‘students.txt’ content looks like below (ID, name-surname, and department)
    117429 MEHMET AKYOL SENG
    124259 EMRE YASAR EEE

    Write a C program that makes use the following functions to be defined:
    a) read keys for three booklet types into corresponding array
    b) read one student information into corresponding arrays
    c) read one student answers into corresponding array
    d) evaluation of one student answers
    e) statistics on student’s answers
    ‘results.txt’ file content may look like as below (4 wrong answer cancels a correct answer!)
    PART-A (Results)
    Std. No. Name & Surname Department Correct Wrong Score
    117429 MEHMET AKYOL SENG 28 20 46.0

    PART-B (Statistics)
    Booklet-A
    Question Correct choice A B C D Blank Success
    1 D 3 2 4 5 1 %33.3
    2 B 5 9 1 7 2 %37.5

    Booklet-B

    Booklet-C

    how to do this one
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to store contents from a text file into arrays?
    By JohnRaphael in forum C Programming
    Replies: 3
    Last Post: 03-19-2016, 03:12 AM
  2. Reading encrypted text file in program!
    By xakzyy in forum C++ Programming
    Replies: 5
    Last Post: 10-03-2013, 12:11 PM
  3. Read text file and store it in an array
    By look2hook in forum C Programming
    Replies: 2
    Last Post: 12-03-2010, 11:47 PM
  4. reading text from a file into your program
    By deltabird in forum C++ Programming
    Replies: 1
    Last Post: 06-26-2003, 10:34 AM

Tags for this Thread