Below is my crazy program.What i want it to do is that it should take two arrays from the user;the 1st array should be the memo & the 2nd should be answers.These two arrays should be passed to function compare of the type bool.In compare the 2 arrays should be compared and the results be stored in another array using bool.This means that the new array in function compare should consist of zeros and ones:zero-wrong & one-correct.How do i copy the results int the ResultArray?
#include<iostream>
using namespace std;
bool Compare(int[],int[],int);
int main()
{
const int arraySize = 5;
int CorrectArray[arraySize];
int PupilArray[arraySize];
cout<<"Enter the memorandum : ";
for(int i = 0;i<arraySize; i++)
{
cin>>CorrectArray[i];
}
cout<<endl;
cout<<"Pupil's answers : ";
for(int j = 0; j<arraySize; j++)
{
cin>>PupilArray[j];
}
cout<<Compare(CorrectArray,PupilArray,arraySize);
return 0;
}
bool Compare(int correct[],int pupil[],int size)
{
bool ResultArray[5] = 0;
for ( int i = 0; i < size; i++ ) {
for(int j = 0; j<size;j++)
if ( correct[i] != pupil[i] ){
i=false;
ResultArray[j]=ResultArray[i];
}
else
{
i=true;
ResultArray[i]=ResultArray[i];
}
}
return ResultArray[];
}