Closed alexey-malov closed 6 years ago
double GetСofactor2x2Matrix(double& minor, int minorF, int minorS)
{
//домножать на -1 в зависимости от нечетности minorF + minorS
double сofactor = pow(-1, minorF + minorS) * minor;
return сofactor;
}
double FindCofactor(double minor, int minorOne, int minorTwo)
{
double сofactor;
((minorOne + minorTwo) % 2 == 0) ? сofactor = minor : сofactor = -minor;
return сofactor;
}
return (условие) ? minor : -minor;
if (ReadMatrix(argv[1], inputMatrix)
{
Matrix3x3 invertedMatrix;
if (InvertMatrix(inputMatrix, invertedMatrix))
{
PrintMatrix(invertedMatrix;)
}
else
{
...
}
}
else
{
...
}
3>c:\teaching\2018\oop\grebneva\oop\lr_01\invert\invert.cpp(85): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
3>c:\teaching\2018\oop\grebneva\oop\lr_01\invert\invert.cpp(86): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
const string nameInputFile = argv[1];
Matrix3x3 matrix;
if (ReadMatrix(matrix, nameInputFile))
void GetСofactorOfMatrix(const Matrix3x3& matrix, Matrix3x3& algebraicComplementsMatrix)
{
for (size_t row = 0; row < SIZE_OF_MATRIX; ++row)
{
for (size_t col = 0; col < SIZE_OF_MATRIX; ++col)
{
double minor = GetMinorOfMatrix(matrix, row, col);
algebraicComplementsMatrix[row][col] = FindCofactor(minor, row + 1, col + 1);
}
}
}