Bowling game score for unlimited looping

Hello, everyone. I am beginner for c. I hope to write a Bowling game score for unlimited looping. But I don't know why I can not run this. Please told me what wrong. Thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
   #include <stdio.h>

int main()
{
	{
		int x[][4], j, i, a[4][];
		for (i = 0; ; i++)                        /*the frist round gets the score*/
		{
			scanf("%d", &x[i][0]);
			if (x[i][0] != 10)
			{
				scanf("%d", &x[i][1]);       /*if the frist round could not get the 10 score, input the second round score*/
			}
			printf("\n");
		}
		for (i = 0; ; i++)
		{                                       /*calculate every frame score exclude the i-1 round frame*/
			if (x[i][0] == 10)
			{
				x[i][1] = 0;
				if (x[i + 1][0] == 10)    x[i][2] = 20 + x[i + 2][0];
				else x[i][2] = 10 + x[i + 1][0] + x[i + 1][1];
			}
			else if (x[i][0] + x[i][1] == 10)
				x[i][2] = 10 + x[i + 1][0];
			else x[i][2] = x[i][0] + x[i][1];
		}
		if (x[i - 1][0] == 10)
		{                                        /*the score get from i frame*/
			if (x[i][0] == 10)    x[i - 1][2] = 20;
			else x[i - 1][2] = 10 + x[i][0] + x[i][1];
		}
		else if (x[i - 1][0] + x[i - 1][1] == 10)   x[i - 1][2] = 10 + x[i][0];
		else x[i - 1][2] = x[i - 1][0] + x[i - 1][1];
		x[0][3] = x[0][2];
		for (i = 1; ; i++)                                   /*calculate the total score*/
			x[i][3] = x[i][2] + x[i - 1][3];
		x[i - 1][3] = x[i - 1][2] + x[i - 2][3];
		for (i = 0; ; i++)
			for (j = 0; j < 4; j++)
				a[j][i] = x[i][j];                               /*exchange the two array*/
		a[0][i] = x[i][0];
		a[1][i] = x[i][1];
		for (j = 0; j < 2; j++)
		{
			for (i = 0; i < 11; i++)                     /*calculate the score in every frame */
				printf("%5d", a[j][i]);
			printf("\n");
		}
		for (j = 2; j < 4; j++)
		{                                         /*calculate every frame score and total score*/
			for (i = 0; i < 10; i++)
				printf("%5d", a[j][i]);
			printf("\n");
		}
	}
		return 0;
}

If you want it to loop infinitely, you need a while(1) {}, not just a pair of braces.
Topic archived. No new replies allowed.