daria-grebneva / OOP

0 stars 0 forks source link

Замечания по программе Invert #7

Closed alexey-malov closed 6 years ago

alexey-malov commented 6 years ago
double GetMinor2x2Matrix(Matrix3x3& matrix, int col, int row)
alexey-malov commented 6 years ago
double GetСofactor2x2Matrix(double& minor, int minorF, int minorS)
{
    //домножать на -1 в зависимости от нечетности minorF + minorS
    double сofactor = pow(-1, minorF + minorS) * minor;
    return сofactor;
}
alexey-malov commented 6 years ago
alexey-malov commented 6 years ago
double FindCofactor(double minor, int minorOne, int minorTwo)
{
    double сofactor;
    ((minorOne + minorTwo) % 2 == 0) ? сofactor = minor : сofactor = -minor;

    return сofactor;
}
alexey-malov commented 6 years ago
if (ReadMatrix(argv[1], inputMatrix)
{
    Matrix3x3 invertedMatrix;
    if (InvertMatrix(inputMatrix, invertedMatrix))
    {
          PrintMatrix(invertedMatrix;)
    }
    else
    {
    ...
    }
}
else
{
    ...
}
alexey-malov commented 6 years ago
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
alexey-malov commented 6 years ago
    const string nameInputFile = argv[1];
    Matrix3x3 matrix;
    if (ReadMatrix(matrix, nameInputFile))
alexey-malov commented 6 years ago
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);
        }
    }
}
alexey-malov commented 6 years ago
oMystique commented 6 years ago
oMystique commented 6 years ago
oMystique commented 6 years ago
oMystique commented 6 years ago