Making grid for fun, having trouble

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
#include <iostream>
using namespace std;
int main()
{

    int row, column;
    row == 0;
    column == 0;

    {if (((row % 2) == 0)

        (while ((row <= 9)

        {while ((column <= 17);
        cout << "-";
        column ++)}));
    row ++ ;

    cout << endl) ;

    else if ((row <= 9)

        while ((column <= 17)
       {cout << "|   " ;
        column = column + 4));
        row ++;}

    return 0;
}}


My error code seems like alot of syntax stuff, I'm trying to get it to look like this
-----------------
| | | | |
-----------------
| | | | |
-----------------
| | | | |
-----------------
| | | | |
-----------------

EDIT:
Its not coming out right

It should be
17 rows
9 columns
17 "-"
5 evenly spaced "| "
Last edited on
I fixed your syntax errors. Now you make it display right.

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
#include <iostream>
using namespace std;

int main()
{

    int row    = 0;
    int column = 0;

    if (row % 2 == 0)
    {
       while (row <= 9)
       {
          while (column <= 17)
          {
             cout << "-";
             ++column;
             ++row;

             cout << endl;
          }
       }
    }

    else if (row <= 9)
    {
        while (column <= 17)
        {
            cout << "|   " ;
            column += 4;
            ++row;
        }
    }
    return 0;
}
Last edited on
Topic archived. No new replies allowed.