this is a program that "Grades" a test (user inputs key and student answers and it's supposed to give a % of the amount right and wrong for the entire class). for some reason, this code isnt working (pay attention to pcntwrong, pcntcorrect...the numbers arent coming out correctly)
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
const int size=16;
void main()
{
char answers[size];
char quiz[size];
int classize;
cout << " Enter the class size: " << endl;
cin >> classize;
for (int x=0; x<size-1; x++)
{
cout << "Enter answer key for # " << (x+1) << endl;
cin >> answers[x];
}
for (int x=0; x<size-1; x++)
cout << " Question # " << (x+1) << " = " << answers[x] << endl;
cout << endl << endl << "Press any key to continue... " << endl;
int cnt=0;
int correct=0;
int wrong=0;
float pcntcorrect = 0;
float pcntwrong = 0;
while (cnt < classize)
{
for (int x=0; x<size-1; x++)
{
cout << " Question # " << (x+1) << " is T or F? " << endl;
cin >> quiz[x];
}
cout << endl << endl << "Press any key to continue...."<< endl;
for (int x=0; x<size-1; x++)
cout << " Question # " << (x+1) << " is: " << endl;
for (int x=0; x<size-1; x++)
if ( quiz[x] == answers[x])
correct++;
else
wrong++;
pcntcorrect = (correct / wrong) * 100;
pcntwrong = 100 - pcntcorrect;
cout << "The # correct: " << pcntcorrect << endl;
cout << "The # wrong : " << pcntwrong << endl;
cnt++;
}
system("pause");
}