read wrong matrix error
This commit is contained in:
1 file changed
+19
@@ -369,6 +369,25 @@ int main() {
|
|||||||
fout.close();
|
fout.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To test wrong matrix size input
|
||||||
|
// Saving a matrix array to a file with one matrix having different dimensions
|
||||||
|
// (uncomment this for testing)
|
||||||
|
|
||||||
|
//ofstream fout("1.txt");
|
||||||
|
//if (fout) {
|
||||||
|
// fout << "3\n";
|
||||||
|
// for (int i = 0; i < 2; i++) // Save the first two matrices normally
|
||||||
|
// fout << M[i] << "\n";
|
||||||
|
// fout << "3 3 "; // Write incorrect dimensions for the third matrix
|
||||||
|
// for (int i = 0; i < 3; i++) {
|
||||||
|
// for (int j = 0; j < 3; j++) {
|
||||||
|
// fout << (rand() % 100) << " "; // Fill the incorrect matrix with random values
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// fout.close();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
// reading a matrix array from a file
|
// reading a matrix array from a file
|
||||||
Matrix<double>* M1;
|
Matrix<double>* M1;
|
||||||
ifstream fin("1.txt");
|
ifstream fin("1.txt");
|
||||||
|
|||||||
Reference in new issue
Block a user