This may seem like a strange question.
Is it possible to define a multi dimensional array's rows as string and its columns as integers. For instance rows A, B , C, or must I do each array as a one dimensional array like my code below.
1 2 3 4 5 6 7 8 9 10 11 12
#include<iostream>
#include <string>
usingnamespace std;
int main()
{
int A [9] = {1,2,3,4,5,6,7,8,9};
int B [9] = {11,22,33,44,55,66,77,88,99};
int C [9] = {1,2,3,4,5,6,7,8,9};
cout << A [3];
return 0;
}
Thank you!! I have played with my code. maybe I should be more specific it seems I would have to define every element . I want the user to be able to have access to an entire row . for example if a user inputs A2 the program looks up the element in that location.
Unsure how to define each entire row. Or if this even the correct procedure for what I want to do.
The program I have now looks up specific location shows number 5 :
1 2 3 4 5 6 7 8 9 10
#include<iostream>
#include <string>
usingnamespace std;
int main()
{ int A;
int grid [3][5] = {{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}};
A = grid [0][0,1,2,3,4];
cout << A;// print to see if entire row is displayed
return 0;
}