-
Arrays of Strings?
Is this possible?
Code:
string a[5];
a[0] = "test 0";
a[1] = "test 1";
a[2] = "test 2";
a[3] = "test 3";
a[4] = "test 4";
a[5] = "test 5";
for (int i = 0; i <= 5; i++)
cout<<a[i];
The compiler gives me these errors:
error C2258: illegal pure syntax, must be '= 0'
error C2501: 'a' : missing storage-class or type specifiers
Basically what I wanted to do was output some strings in a class. If this isn't possible is there another way of doing this?
-
This will work:
Code:
string a[6];
a[0] = "test 0";
a[1] = "test 1";
a[2] = "test 2";
a[3] = "test 3";
a[4] = "test 4";
a[5] = "test 5";
for (int i = 0; i < 6; i++)
cout<<a[i];
return 0;