drawing functions beside each other

hello all,
i want to draw two grids beside each other in the console.
if i just call the function it draws on top of each other.
how can i make it draw sideways?
thank you!

here is my grid drawing function:

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
void draw_map()
{
    cout <<endl;
    char alpha='a';
    for(int i =0; i<7; i++,alpha++)
    {
        cout<<alpha<<"|";
        for(int k=0; k<10; k++)
        {
            if(grid[k][i]==SHIP1)
            {
                cout<<"1 ";
            }
            else if(grid[k][i]==SHIP2)
            {
                cout<<"2 ";
            }
            else if(grid[k][i]==SHIP3)
            {
                cout<<"3 ";
            }
            else if(grid[k][i]==HIT)
            {
                cout<<"* ";
            }
            else if(grid[k][i]==MISS)
            {
                cout<<". ";
            }
            else
            {
                cout<<"  ";
            }
        }
        cout<<"\n";
    }

    cout<<"  --------------------\n";
    cout<<"  0 1 2 3 4 5 6 7 8 9\n";
}
You have two options:
1) Modify your draw_map function to draw both simultaneously
2) Use another library like the ncurses library to let you draw characters to specific locations.
thank you for the answer,
the problem is i cant use non standard libraries that arent included in the g++ compiler
thus im left with the first option.
so how should i modify the function to serve my purpose?
i modified the function as you suggested and it worked! thanks!
i just added a "\t" in the middle of the function and drew the second grid's x-axis
Glad things worked out.
Topic archived. No new replies allowed.