This is a discussion on i Need help with this program plzzzz within the C and C++ forums, part of the Programming Talk category; Use structure to hold a candidate’s data. A multiple-choice examination consists of twenty-five questions. Each question has ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
i Need help with this program plzzzz
Use structure to hold a candidate’s data.
A multiple-choice examination consists of twenty-five questions. Each question has five choices, labeled A, B, C, D and E. The first line of data contains the correct answers to the twenty-five questions in the first 25 consecutive character positions, for example: ABCDABCDABCDABCDABCDABCDA Each subsequent line contains the answers for a candidate. Data on a line consists of a candidate number (an integer), followed by one or more spaces, followed by the twenty five answers given by the candidate in the next twenty five consecutive character positions. A space is used if a candidate did not answer a particular question. You may assume all data are valid and stored in a file exam.txt. A sample line is: N0001 ABCDABCDABCDABCDAB DABCDA There are at most 30 candidates. A line containing a “candidate number” 0 only indicates the end of the data. Points for a question are awarded as follows: correct answer: 5 points; wrong answer: 0 points; no answer: 0 points. Write a program using the below input to process the data and print a report consisting of candidate number and the total points obtained by the candidate, in descending order by candidate number. At the end, print the average number of points gained by the candidates. You must use at least two functions: one to print the results and one to calculate the total points. N0000 ABCDABCDABCDABCDABCDABCDA N0001 ABCDBACDCDABABDC DCDABCDD N0010 ABDCBBCDAD C BDDBDCBADCAA N0011 ABCDABCDABCDABCDABCDABCDA N0100 ABCDABC ABCDA CDABCDABCDA |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) | Steve Summit | Tech FAQ | 0 | 06-15-2004 07:00 AM |
| comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:01 AM |
| comp.lang.c Answers to Frequently Asked Questions (FAQ List) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:00 AM |
| comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) | Steve Summit | Tech FAQ | 0 | 05-15-2004 07:00 AM |
| Apple II Csa2 FAQs: Telecom Hardware & Transfers, Part 20/25 | rubywand@swbell.net | Tech FAQ | 0 | 04-04-2004 08:29 AM |