I've changed the code but still get windows error messages and then the file crashs. Any more suggestions about why? Thanks all in advance !!

#include <stdio.h>

int main()
{
FILE* infile;
FILE* outfile;
int x, y, answer;
char op;

infile = fopen("calc4.in", "r");
outfile = fopen("calc4.out", "w");

do
{

fscanf(infile, "%d %c %d", &x, &op, &y);


if (op == '+') {
answer = x + y;
} else
if (op == '-') {
answer = x - y;
} else
if (op == '*') {
answer = x * y;
} else
if (op == '/') {
answer = x / y;
}
fprintf(outfile,"\n%d %c %d = %d", x, op, y,answer);

else
if (y == '0')
fprintf(outfile,"\n Division by Zero is not allowed!");
else
fprintf(outfile,"\n Unknown Operator!");


}while (!((x == 0) && (y == 0)));




return 0;
}