C++ Program URGENT HELP. Can someone help me get to the given output, I don't know what's wrong with my code.

#include
#include
#include

using namespace std;

//Function Prototypes
void print(const string &);
void read(const char [],string &);
int compare(const string &,const string &,string &);

int main()
{
//Declare Variables
string key,answers,score;
char fileKey[]="key.dat",fileAns[]="answer.dat";
float pRight;

//Initialize or input i.e. set variable values
read(fileKey,key);
read(fileAns,answers);

//Score the exam
pRight=compare(key,answers,score);

//Display the outputs

cout<<"C/W ";print(score);
cout< > res;

//Closing file
fin.close();
}

//Function that prints string
void print(const string &res)
{
//Iterating over each character
for(int i=0; i cout << res[i] << " ";
}

//Function that compares the key and answers
int compare(const string &key,const string &answer,string &score)
{
int cnt=0, i=0;

//Assigning temporary string
score = "WWWWWWWWWWWWWWWWWWWW";

//Iterating over each character
for(i=0; i {
//Comparing char by char
if(key[i] == answer[i])
{
//Incrementing count
cnt += 1;
score[i] = 'C';
}
}

return cnt;
}

C Program URGENT HELP Can someone help me get to the given output I dont know whats wrong with my code include include include using namespace std Function Prot class=
C Program URGENT HELP Can someone help me get to the given output I dont know whats wrong with my code include include include using namespace std Function Prot class=