cout << "Do you want to repeat the procedure?/n";
cin >> choise;
}while(choise == 'y' || choise == 'Y');
return 0;
}
//definition for function setKey()
//it takes as argument an array with the right answers
//and copies the information into his answers array
void TestGrader::setKey(char array[])
{
for(int index = 0;index < 20;index++)
{
answers[index] = array[index];
}
}
//definition of function grade()
//it takes an array with the given answers
//as argument
//and gives back the results of the exam
void TestGrader::grade(char array[])
{
int count = 0;
for(int index = 0;index< 20; index++)
{
if(array[index] != answers[index])
{ count++;
cout << "Answer " << (index + 1) << " is wrong.\n";
}
}
if(count > 5)
{
cout << "The person failed the test with " << count << " mistakes!\n";
}
else
cout << "The person passed the test with " << count << " mistakes!\n";
Your program works just fine on my machine. Although I think you meant '\n' and not '/n' (in main()). Is this a compiler error? Or is the program closing with this error message?