How to output an array of strings?

This is sort of a dumb question but, how do you use a for loop to iterate through strings to display them in a console?

for (int w = 0; w < (int)strlen(mystring); w++)
{
printf("%c", mystring[w]);
}

for (int w = 0; w < (int)mystring.length(); w++)
{
std::cout <<mystring[w];
}
1
2
3
4
5
6
7
8
9
10
	string index [2] = {
	"1. Tip",
	"2. Area and price"	
	
	};
	
		
		for(int w = 0; w< (int)index.length(); w++){
			cout<<index[w];
		}


I get an error for index.length() it says that it must be a class, struct, or union
1
2
3
4
5
6
7
8
for(int w = 0; w< (int)index.length(); w++){
for(int t = 0; t < (int)index[w].length(); t++){
			cout<<index[w][t];
		} 
}


Topic archived. No new replies allowed.