I'm having trouble trying to have the user input a string matrix of numbers and trying to convert them to integers so I can perform numerical operations on matrices. My code is below.
    int matrix1[10][10];
    string first_matrix;
    cout << "Enter first matrix:\n";
    while (first_matrix != " ")
        getline(cin, first_matrix);
        for(int i = 0; i < strlen(first_matrix); i++)
            if(first_matrix[i] == "")
                break;
            else(first_matrix[i] == " "){
                n = n + 2;
                if (first_matrix[i] == "\n"){
                    m++;
                }
                first_matrix[i] = matrix1[i] - '0';
            }
    return 0;
I know writing a while loop for getline (something like while(line!="")
getline(cin, line);)  makes it so that multiple lines can be read as input. But my question is how would I extract these lines of strings and put them into a new array with their integer forms? Also, rather than using first_matrix[i] = matrix1[i] - '0'; I'm supposed to use stoi, but I'm a bit confused on how to use stoi also while creating a new array of numbers. ( I know it converts the string to integers but how do I actually use it to do that? )
 
     
    