fixed windows build error

This commit is contained in:
Krishna Vedala 2020-05-26 09:32:37 -04:00
parent fb3a8091f9
commit 4b25222d43
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -6,7 +6,11 @@ int main() {
std::cout << "Matrix size: "; std::cout << "Matrix size: ";
std::cin >> mat_size; std::cin >> mat_size;
double mat[mat_size + 1][mat_size + 1], x[mat_size][mat_size + 1]; double **mat = new double *[mat_size + 1], **x = new double *[mat_size];
for (i = 0; i <= mat_size; i++) {
mat[i] = new double[mat_size + 1];
if (i < mat_size) x[i] = new double[mat_size + 1];
}
std::cout << std::endl << "Enter value of the matrix: " << std::endl; std::cout << std::endl << "Enter value of the matrix: " << std::endl;
for (i = 0; i < mat_size; i++) { for (i = 0; i < mat_size; i++) {
@ -49,5 +53,13 @@ int main() {
std::cout << "x" << i << "= " << x[i][i] << std::endl; std::cout << "x" << i << "= " << x[i][i] << std::endl;
} }
for (i = 0; i <= mat_size; i++) {
delete[] mat[i];
if (i < mat_size) delete[] x[i];
}
delete[] mat;
delete[] x;
return 0; return 0;
} }