Multidimensional Array - can't compile

Hello guys. Last time i couldn't compile something i understood that i have to enable C++11 ISO etc... in my CodeBlocks settings. I'm not sure what i am missing this time. The example comes right out of the textbook i read. Help please.



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

int main ()
{
    srand(2);

    const int width = 9;
    const int heigth = 5;

    char Lts[height][width];

    for(int i=0; i<heigth; i++)
    {
        for(int j=0; j<width; j++)
        {
            lts [i][j] = 'A' + rand()%25;
            cout<< Lts[i][j]<< " ";
        }
        cout<<endl;
    }
    system("pause");
    return 0;
}

Last edited on
Line 10 and 14: 'height' spelled incorrectly

Line 18: change 'lts' to 'Lts'
I had few unsuccessful tries and went mad (renaming variables). I am sorry. Things worked out now, mate. Thank you!
Last edited on
Topic archived. No new replies allowed.