Hi I am trying to do a homework problem but this is about as far as i have gotten. need some help if you will. also am a complete novice so would like it if you explained in baby terms :) Sorry...

am trying to solve this problem...
You have been asked to construct a program that will assist in grading multiple choice exams.
Prompt the user for the number of questions up to 20.
Prompt the user for the correct answer to each question as a letter(char fom A-E).
Store this information in an answer key.
Prompt the user for the number of students in the class up to 50.
For each student in the class, prompt the user for a student ID(int) and the students answer to each question(char).
Finally, grade the exams and store the results(int).
Find the average, high and low scores and output the results.

Hint: You will need several arrays to store all of the information:
1) An array of char to hold the answer key
2) An array of int to hold the student ID's
3) A 2D array of Char to hold the answers
4) An array of int to hold the scores

EXAMPLE INPUT/OUTPUT:

Enter number of Questions: 2
Enter the correct answer for Question 1: A
Enter the correct answer for Question 2: B

Enter number Students in the class: 2

Enter the Student ID for for student 1: 12345
For Student 12345, Enter the answer to Question 1: A
For Student 12345, Enter the answer to Question 2: B

Enter the Student ID for for student 2: 54321
For Student 54321, Enter the answer to Question 1: A
For Student 54321, Enter the answer to Question 2: A

Results
======================================================
Student ID      Score
  12345          2/2
  54321          1/2
======================================================
High Score = 2/2
Low Score  = 1/2
Average    = 1.50

my code so far... (is probably completely wrong)

#include <iostream>
using namespace std;

const int maxquestions=20;
const int maxstudents=50;

void getanswerkey(char key[],int& numquestions);
void getstudentanswers(int studentid[], char answers[][20], int numquestions, int numstudentids);
void gradeexam(int scores[], char key, char answers[][20], int numquestions, int numstudentids);
void output();

void main()
{
    char key[maxquestions];
    int numquestions, numstudents;
    int studentid[50];
    char answers[50][20];
    int scores[50];

    system("pause");
}
void getanswerkey(char key[], int& numquestions)
{
    cout << "Enter number of questions: ";
    cin >> numquestions;
    for(int i=0; i<numquestions; i++)
    {
        cout << "Enter correct choice for question " << i+1;
        cin >> key[i];
    }
}
void getstudentanswers(int studentid[], char answers[][20], int numquestions, int numstudents)
{
    cout << "Enter number of students in the class: ";
    cin >> numstudents;
    for(int student=0; student<numstudents; student++)
    {
        cout << "Enter the student id for the student " << student+1 << ": ";
        cin >> studentid[student];
        for(int index=0; index<numquestions; index++)
        {
            cout << "For student " << studentid[student] << ", Enter the answer to question " << index+1 << ": ";
            cin >> answers[student][index];
        }
    }
}
void gradeexam(int scores[], char key, char answers[][20], int numquestions, int numstudents)
{
    for(int student=0; student<numstudents; student++)
        for(int question=0; question<numquestions; question++)
        {
            if(key[questions]==answers[student][question])
                scores[student]++;
        }
}

Welcome to Daniweb!

First, please use code tags around your code, it makes it much easier for us to read. Second, I STRONGLY recommend that you use std::vector instead of c-style arrays. It will save you hours of headaches for sure.

Good luck,

Dave

Firstly 'void main' and 'system("pause");' are BAD programming practices use 'int main' and 'cin.get()' instead .

Anyways here is your code wrapped in CODE tags

#include <iostream>
using namespace std;

const int maxquestions=20;
const int maxstudents=50;

void getanswerkey(char key[],int& numquestions);
void getstudentanswers(int studentid[], char answers[][20], int numquestions, int numstudentids);
void gradeexam(int scores[], char key, char answers[][20], int numquestions, int numstudentids);
void output();

void main()
{
    char key[maxquestions];
    int numquestions, numstudents;
    int studentid[50];
    char answers[50][20];
    int scores[50];

    system("pause");
}
void getanswerkey(char key[], int& numquestions)
{
    cout << "Enter number of questions: ";
    cin >> numquestions;
    for(int i=0; i<numquestions; i++)
    {
        cout << "Enter correct choice for question " << i+1;
        cin >> key[i];
    }
}
void getstudentanswers(int studentid[], char answers[][20], int numquestions, int numstudents)
{
    cout << "Enter number of students in the class: ";
    cin >> numstudents;
    for(int student=0; student<numstudents; student++)
    {
        cout << "Enter the student id for the student " << student+1 << ": ";
        cin >> studentid[student];
        for(int index=0; index<numquestions; index++)
        {
            cout << "For student " << studentid[student] << ", Enter the answer to question " << index+1 << ": ";
            cin >> answers[student][index];
        }
    }
}
void gradeexam(int scores[], char key, char answers[][20], int numquestions, int numstudents)
{
    for(int student=0; student<numstudents; student++)
        for(int question=0; question<numquestions; question++)
        {
            if(key[questions]==answers[student][question])
                scores[student]++;
        }
}

What exactly is the problem you are facing.
1. Avoid void main(), it's non-standard.
2. Avoid system() calls, since they are worthless & slow
3. Also I recommend you use a class for this.

class Student
{
   int id;
   char Answers[20];
};

//Create 50 Objects
Student Students[50];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.