I'm a beginner in C++
I been trying to make a function that prints out all the elements within a 2D array, but I can't get this work, and I need some help.
It appears to me that my printArray function can't take 2D array as a valid input data. Can anyone throw me an advice? Also, would there be a better way to build a multidimensional string array without using std::string?
Thanks for your help!
int main ()
{
std::string faces[5] = { "Pig", "sex", "John", "Marie", "Errol"};
printArray(faces);
std::string TwoD[2][2] = {{ "Aces", "Deuces"}, { "Hearts", "Diamonds"}};
//print2DArray(TwoD);
std::cin.get();
}
void print2DArray(std::string x[])
{
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
{
std::cout << x[i][j] << std::endl;
}
}