# attempt 2

• 05-26-2005
cppdungeon
attempt 2
heres my delimma: i made a program to print a map somewhat like this: [][] (exept 10X10) each square would changes
[][] depending on what number each "square" eaquals so if b[0][0]==0; then the square would be []. hence i used nested loops to make all b[x][y]=0; and so on. its supposed to be kind of like chess,a dn i have the "enemy program" down, but why isnt this code working?
Code:

```#include <iostream> using namespace std; int main(){ int b[9][9]; int x, y, ex, ey, ax, ay, turncount; do{ for(ay=0;ay<9;ay++){ for(ax=0;ax<9;ax++){ b[ax][ay]=0; } } if(turncount>0){ b[x][y]=1; } b[2][2]=2; for(y=0;y<9;y++){ for(x=0;x<9;x++){ if(b[x][y]==0){ cout<<"[]"; } if(b[x][y]==1){ cout<<"*•"; } if(b[x][y]==2){ cout<<"τζ"; } } cout<<"\n"; } for(;x>9 || y>9;){ cin>>x>>y; turncount++; } cin.get(); } while(0<1); cin.get(); }```
• 05-26-2005
JoshR
I'll look at it, but btw that code is hard to read, you need to learn how to use spaces buddy and the tab button.
• 05-27-2005
anykey
Yes this code is hard to read.
First thing that really sticks out here is that the do-while loop uses (0<1) as a condition which is always true. Since you don't have any break exit or return statements inside this loop it will run forever.
• 05-27-2005
JoshR
you might as well replace this
Code:

`for(;x>9 || y>9;)`
with a while statement
Code:

`while (x>9 || y>9)`