I have a program that is supposed to open a file based on the coordinate on an x, y, and z coordinate. It then gets information about that coordinate and outputs it. But for some reason it does not work correctly.. So I took away the Z axis to make it easier to work with, and then I deformed some of the code to try to find the bug, but i cannot. Maybe someone could help me if they looked at it, so here is the defective code... Please help :<br><br><br>do<br>{<br>acc = 1;<br>cin >> dir;<br>strcpy(town, "Cador"
;<br>strcpy(dirtest, "n"
;<br>strcpy(dirtest1, "ne"
;<br>strcpy(dirtest2, "e"
;<br>strcpy(dirtest3, "se"
;<br>strcpy(dirtest4, "s"
;<br>strcpy(dirtest5, "sw"
;<br>strcpy(dirtest6, "w"
;<br>strcpy(dirtest7, "nw"
;<br>strcpy(dirtest8, "d"
;<br>strcpy(dirtest9, "u"
;<br>if (strcmpi(dir, dirtest) == 1)<br>{<br>y++;<br>y1 = 1;<br>}<br>else if (strcmpi(dir, dirtest1) == 1)<br>{<br>y++;<br>y1 = 1;<br>x++;<br>x1 = 1;<br>}<br>else if (strcmpi(dir, dirtest2) == 1)<br>{<br>x++;<br>x1 = 1;<br>}<br>else if (strcmpi(dir, dirtest3) == 1)<br>{<br>y--;<br>y1 = -1;<br>x++;<br>x1 = 1;<br>}<br>else if (strcmpi(dir, dirtest4) == 1)<br>{<br>y--;<br>y1 = -1;<br>}<br>else if (strcmpi(dir, dirtest5) == 1)<br>{<br>y--;<br>y1 = -1;<br>x--;<br>y1 = -1;<br>}<br>else if (strcmpi(dir, dirtest6) == 1)<br>{<br>x--;<br>x1 = -1;<br>}<br>else if (strcmpi(dir, dirtest7) == 1)<br>{<br>y++;<br>y1 = 1;<br>x--;<br>x1 = -1;<br>}<br>else if (strcmpi(dir, dirtest8) == 1)<br>{<br>z--;<br>}<br>else if (strcmpi(dir, dirtest9) == 1)<br>{<br>z++;<br>}<br>else<br>{<br>acc = 0;<br>}<br>do {<br>if (acc == 0)<br>{<br>break;<br>}<br>strcpy(town, "Cador"
;<br>if(x < 10 )<br>{<br>strcat(town, "00"
;<br>}<br>else if(x > 9 && x < 100)<br>{<br>strcat(town, "0"
;<br>}<br>sprintf(town1, "%d", x);<br>strcat(town, town1);<br>if(y < 10 )<br>{<br>strcat(town, "00"
;<br>}<br>else if(y > 9 && y < 100)<br>{<br>strcat(town, "0"
;<br>}<br>sprintf(town2, "%d", y);<br>strcat(town, town2);<br><br>strcat(town, "000"
;<br>// sprintf(town3, "%d", z);<br>// strcat(town, town3);<br>strcat(town, ".dat"
;<br>ifstream infile(town);<br><br><br>acc = 1;<br>infile >> roomdesc;<br>cout << roomdesc << endl;<br>infile.close();<br>}<br>while (strcmpi(dir, "exit"
!= 1);<br>}<br>while (strcmpi(dir, "exit"
!= 1);