C++ determinant calculator
double matrix[dimension][dimension];

  
  

double array[dimension * dimension];

  
  

double matrix[dimension][dimension];

  
  

    double subMatrix[dimension - 1][dimension -1];

  
  

    double array2[(dimension - 1) * (dimension - 1)];



None of those are legal C++, because dimension isn't a constant-expression.



We have a signed/unsigned comparison here:


    for(int k = 0; k &lt; str.length(); k++) {



We can easily eliminate the compiler warning by using a more appropriate type:

    for (std::size_t k = 0;  k &lt; str.length();  ++k) {


But a better fix, given we only use k to index str, is to use a range-based loop:

    for (auto const c: str) {




When using operator&gt;&gt; on a stream, we must always check that it succeeded, before we depend on the result:

std::size_t dimension;
std::cin &gt;&gt; dimension;
if (!std::cin) {
    std::cerr &lt;&lt; "Input failed\n";
    return EXIT_FAILURE;   // needs &lt;cstdlib&gt;
}
if (dimension == 0) {
    std::cout &lt;&lt; "1\n";    // empty matrix determinant
}