Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- int main() {
- double a, b, c, d, e , f;
- cin >> a >> b >> c >> d >> e >> f;
- double D; // определитель
- double Dy; // определитель Dy
- double Dx; // определитель Dx
- double x, y;
- D = a * d - b * c;
- if (D != 0) { // единственное решение
- // решаем методом Крамера
- Dx = e * d - b * f;
- Dy = a * f - c * e;
- x = Dx / D;
- y = Dy / D;
- cout << 2 << x << " " << y;
- }
- else
- {
- if (((a == 0) && (b == 0) && (e != 0)) ||
- ((c == 0) && (d == 0) && (f != 0)) )
- {
- // несовместна
- cout << 0;
- }
- else
- {
- if (((a == 0) && (b == 0) && (e == 0)) ||
- ((c == 0) && (d == 0) && (f == 0)) )
- {
- // любая пара x0 y0
- cout << 5;
- }
- }
- else
- {
- }
- }
- return 0;
- }
- void MainWindow::on_pushButton_clicked()
- {
- QString strValue = ui->m_pQLineEdit->text();
- QString result = crypto.encryptToString(strValue);
- QByteArray pswNsalt (strValue.toStdString().c_str()) ;
- pswNsalt.append(ui->lineEdit_salt_key->text()) ;
- QString hashedSaltedPsw = QCryptographicHash::hash(pswNsalt, QCryptographicHash::Sha256).toHex() ;
- qDebug() << "encrypted psw: " << result << "\n" ;
- ui->lineEdit_hash->setText(result);
- }
- void MainWindow::on_pushButton_decrypt_clicked()
- {
- QByteArray pswNsalt (ui->lineEdit_hash->text().toStdString().c_str()) ;
- pswNsalt.append(ui->lineEdit_salt_key->text()) ;
- QString hashedSaltedPsw = QCryptographicHash::hash(pswNsalt, QCryptographicHash::Sha256).toHex() ;
- QString decrypted = crypto.decryptToString(ui->lineEdit_hash->text());
- qDebug() << "encrypted psw: " << decrypted << endl ;
- ui->lineEdit_decrypt->setText(decrypted);
- }
Advertisement
Add Comment
Please, Sign In to add comment