+ 1
Array with string? An example please?
5 Respuestas
+ 9
Given you're taking only C++, I'll do it in that language.
string arrayColors[] = {"Red", "Green", "Blue"};
cout << arrayColors[1] << endl;
+ 5
string arrayWords[][] = {{"home", "close", " door", "blue"},{"yellow", "window", " dog", "open"}, {"cat", " box", "green", "car"}, {"dad", " friend", "brother, "mom"}};
cout<< arrayWords[1][2] << endl; // outputs dog
arrayWords[0] is {"home", "close", " door", "blue"}
arrayWords[1][0] is "yellow"
+ 1
thanks, have a nice day! Greetings from México.
0
c++
0
oh! thanks so much, and an example array bi-dimentional?
string arrayWords[3][4] = {{"home", "close", " door", "blue"},{"yellow", "window", " dog", "open"}, {"cat", " box", "green", "car"}, {"dad", " friend", "brother, "mom"}};
cout<< arrayWords[2][3] << endl;
//screen out:" dog"
it's ok made this way?