Assignment is to loop through two data files and compare the answers to find the number of correct answers.Then produce a report that shows what responses were given to the 20 questions.This second part includes a 2-D array of counters.What I have that works for the first section is as follows:
#include<fstream>
#include<iostream>
#include<iomanip>
using namespace std;
void main()
{
ifstream finans,fintests;
char key[21],idno[23],responses[21];
int i=0,j=0,count=0, numcorrect=0,counter[21][6]={0};
You could try first casting the characters as int's and then add one to the counter set per question i and per responses[i]:
1 2 3 4 5 6 7 8 9 10 11 12
for(i=0;i<20;i++)
{
if (responses[i]==key[i]&&responses!="")
{
numcorrect++;
}
//cast as int
int respons[21];
respons[i]=(int)responses[i]-'A';
//counter gets larger for every respons[i] to question i
counter[i][respons[i]]++;
}