If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Challenging C++ program challenge. If your up for it

So i was given an assignment with some unusual parameters. My teacher likes to add difficult objectives to make the code longer (really just to be evil) and this project is proving to be a bit of a problem. I have worked on several programs he has assigned but the one i can not wrap my finger around is the one based on creating answer key and test results for students. I will post it below:

{

DECRIPTION
Write a C++ program to grade multiple-choice, including True/False, questions for an exam given in a class. A class may have one or more sections. The answer keys are the same for all sections of a class for one exam, but the number of students is normally different for different sections. Your program will be used for different classes and/or different exams, and the number of questions will be different. But any exam can have at most 30 questions. The answer key and a student's answer to a question could be a digit, between 1 and 5 (inclusive), or a character among A, B, C, D, E, F and T, or lower case equivalent.

Input Data1. The first value in the input file is the number of questions of the exam.

2. The second line is the answer keys without spaces between any two answers.

3. The next line is the number of sections, followed by data for all sections.

4. The data for a section begins with the number of students, followed by students' data.

5. The data for each student is on a separate line, beginning with the answers from the student followed by the student's last name.

6. As the key answers, there is no space between any two answers.

7. The student's last name comes after his/her last answer without any spaces between.

8. Any student's last name has at most 15 characters.

Sample input is given later.You can assume the input data are correct and do not check for invalid values.

Output Data1. For each student, last name, number of correct answers, and Pass or Fail. A student passes an exam if the number of correct answers is 60% or better of total number of questions, and fails otherwise.

For each section, the total number of students and the number of students who passed the exam.

For the entire class, the number of sections, the total number of students and the number of students who passed the exam.

See sample output later for the exact output format.

The following requirements must be followed:

You must NOT use structs or 2D array.

You must use the following functions in your program.
// The function reads in numQuestions answers into array answers.
// Parameters: (out, in)
void ReadAnswers(char answers[], int numQuestions);

You must use the same function ReadAnswers() to read the answer keys and the answers for each student.

You must use for loops to process all sections of the class, all students of a section, and all answers of a student. No while loops are allowed on this assignment.

Your main() function could be like the following:
Read number of questions
Read and store the answer keys
Read number of sections
For each section
Process all students' answers
Update class results
Display results for the section
Display results for the entire class

You can also use function toupper(x) to convert a character to upper case. You need to include header file <ctype.h> to use the function.

So that is the entire thing. I understand if you do not want to help me with all of it however any help will be appreciated. Thank you for anything you are willing to/can do.
Please feel free to send me questions or emails if you have any questions about it.
Again you all rock for the help, this community is a great one indeed

Re: Challenging C++ program challenge. If your up for it

Originally Posted by flanman1991

So i was given an assignment with some unusual parameters. My teacher likes to add difficult objectives to make the code longer (really just to be evil)

Length of code does not determine difficulty of code. All of the objectives in that assignment should not be difficult, you just need to sit down and complete each one. Also, programming teachers are going to give assignments that few will complete -- the reason being that very few of your fellow students will have the aptitude to write, test, and debug real programs anyway (might as well be blunt about it). Those students will complete this assignment with minimal, if any help needed.

The way you handle such an assignment is to work on each piece of the assignment. The "write everything at once and hope it works" is not the way to handle this. For example, where is your test function to see if you can read the input correctly? Did you write it? It doesn't matter what the rest of the assignment states, can you read the test input successfully?

Once you write that routine (and test it), then you start to handle the other parts of the assignment one at a time, testing each piece thorougly before going to the next item.

When you have specific questions to the assignment, then ask them. It doesn't help posting an entire assignment in a forum expecting "help" without stating what you need help with.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.