hi
could u plz help me out with this array program that i have written ....there is NO error in this program while compiling...but it's not running well .the output is not coming our right as it should.i don't know why........i have checked it 100 times and i still can't figure out why is it not running well.........?
this program is about.....A TEST CONSISTING OF 8 MULTIPLE CHOICE ITEMS(QUESTIONS) IS ADMINISTERED TO A BATCH OF 3 STUDENTS.
so i have done like this:-
#include<stdio.h>
#include<conio.h>
#define STUDENTS 3
#define ITEMS 8
void main()
{
char key[ITEMS+1],response[ITEMS+1];
int i,student,count,n,correct[ITEMS+1];
/* reading of correct answers into an array*/
printf("input key to the items");
for(i=0;i<ITEMS;i++)
scanf("%c",&key[i]);
/*evaluation begins*/
for(student=1;student<=STUDENTS;student++)
{
/*reading student responses and counting correct ones*/
count=0;
printf("input response of student:%d",student);
for(i=0;i<ITEMS;i++)
scanf("%c",&response[i]);
for(i=0;i<ITEMS;i++)
correct[i]=0;
for(i=0;i<ITEMS;i++)
if(response[i]==key[i])
{
count=count+1;
correct[i]=1;
}
/*printing of results*/
printf("student:%d",student)
printf("score is %d out of %d\n",count,ITEMS);
printf("response to the following items are wrong\n");
n=0;
for(i=0;i<ITEMS;i++)
if(correct[i]==0)
{
printf("%d",i+1);
n=n+1;
}
if(n==0)
{
printf("nil\n");
}
getch();
}