Void initData (int map [] [16])
{
int i, j;
//load the data allows users to wait for, in general, load data faster
Printf (" the load of the game, please later... ");
//traverse map data in a
for(i=0; I & lt; 14. I++)
{
For (j=0; J & lt; 16. J++)
{
//traverse to 2 (people), the recorder, the coordinates of x, y is the previously defined global variable
//traverse to 3, the increase in the number of boxes, boxs is the previously defined global variable
If (map [I] [j]==52 | | map [I] [j]==103)
{
Boxs++;
}
}
}
}
Int main ()
{
Int map [14] [16].
For (int n=1; N<44. N++)
{
ReadMap (map, n);//read from the file map
InitData (map);
While (1)
{
System (" CLS ");//clear screen
PrintMap (map);
If (boxs==0)
{
break;
}
KeyDown (map);
No (map);
}
}
System (" pause ");
}
Void no (int map [] [16])
{
Printf (" better ");
For (int I=0; I & lt; 14. I++)
{
For (int j=0; J & lt; 16. J++)
{
//traverse to 2 (people), the recorder, the coordinates of x, y is the previously defined global variable
//traverse to 3, the increase in the number of boxes, boxs is the previously defined global variable
If (map [I] [j]==103)
{
Boxs,;
}
}
}
}
CodePudding user response:
No project background, no data, exampleStrong lu incomplete code, is really a waste of time, usually one who is, won't dry
CodePudding user response: