I have a small glitch in my prog I am using qunicy99 and file redirection of following text...my purpose is to scan their pins and marks down score and know the winner....
But i am stuck at the scanning and displaying the pin... ur help with be appreciated if u could just figure out the glitch why it is running twice for each players
Code:
#include<stdio.h>
#include<string.h>
int
main(void)
{
char players[200];
int i,j,k,l;
int frames[10][2];
int frame11,frame12,trash;
while (strcmp (gets (players) ,"End of data") != 0) {
printf("\n\n\n\n Frame 1 2 3 4 5 6 7 8 9 10 \n\n");
puts(players);
printf(" ");
for(j=0;j<=8; j++) {
k=0;
scanf("%d",&frames[j][k]);
if(frames[j][k]<10) {
scanf("%d",&frames[j][k+1]);
printf(" %d-%d ",frames[j][k],frames[j][k+1]);
} else if(frames[j][k] ==10) {
frames[j][k+1] =0;
printf(" X ");
}
if(j==8) {
k=0;
j=j+1;
scanf("%d",&frames[j][k]);
if (frames[j][k] ==10){
scanf("%d", &frame11);
scanf("%d", &frame12);
scanf("%d", &trash);
printf(" X/%d/%d",frame11,frame12);
}
else if(frames[j][k] !=10){
scanf("%d",&frames[j][k+1]);
l = frames[j][k]+frames[j][k+1];
if(l == 10){
scanf("%d", &frame11);
printf(" %d/%d",frames[j][k],frame11);
scanf("%d", &trash);}
else if (l !=10){
printf(" %d-%d",frames[j][k],frames[j][k+1]);
scanf("%d", &trash);}
}}
}
}
return(0);
}