array help.

I am trying to make a program that goes thro a data sheet that has a students id and there test answers (20 answers per student) then goes through another data sheet that has the key. Using string I have to see how many the student got right and output it. I got that. Part B is to output a table saying how answers were guessed on which question. EX question 1 4-a's 10-b 4-c 1-d 0-e.

so the table will be a 20 by 5. I have no clue how to do anyting with this table. Please help

here is what I have so far
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# include <iostream>
# include <fstream>
# include <string>



using namespace std;

int main (void)
{
	string key, id, answers;
	int i,k,m, numcorrect, table[20] [5];	
	ifstream test, answerkey;
	
	test.open("test.txt");
	answerkey.open("key.txt");
	
	answerkey>>key;
	test>>id>>answers;
	
	while(!test.eof())
	{
			numcorrect = 0;
			for (i = 0; i < 20; i++)
				if (answers [i]==key[i])
				numcorrect++;
				
			for (m = 0; m < 20; m++);
			
			
			for(k=0; k < 5; k++);
			 
				cout<<table [m] [k]
			 	
				
				
		cout<<id<<" "<<numcorrect<<endl;
		test>>id>>answers;
	}
	
	cin>>id;
}



so it would look something like
A B C D E
1 1 6 4 8 9
2 10 5 0 0 5
3 1 2 3 4 10
4..... etc
5
6
7


and then have an * by the correct one
Last edited on
anyone?
Honestly the question isn't really clear or I would've tried to help already.
ok so the simulation is that I am a teachers assistant and I need to make a program that outputs the students id and the total number of questions he got right on the test. then I have to make an array that outputs the guesses for all the questions. ex question one 'a' was guessed 2 times 'b' was guessed 3 times and c was guessed '15 times.

I have all the students id's and their guesses in data file answers then the test key in data file key.

I am having problems tallying up how many times a letter was guessed for each question and outputting it in an array.

Is that better? I am known for not explaining stuff enough. sorry.
Topic archived. No new replies allowed.