Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- double **a, *y, *x, **a_copy;
- int n, input;
- system("chcp 1251");
- system("cls");
- cout << "Розмір матриці : ";
- cin >> n;
- a = new double*[n];
- y = new double[n];
- a_copy = new double*[n];
- for (int i = 0; i < n; i++)
- {
- a[i] = new double[n];
- a_copy[i] = new double[n];
- for (int j = 0; j < n; j++)
- {
- cout << "a[" << i << "][" << j << "]= ";
- cin >> input;
- a[i][j] = input;
- a_copy[i][j] = input;
- }
- }
- for (int i = 0; i < n; i++)
- {
- cout << "y[" << i << "]= ";
- cin >> y[i];
- }
- sysout(a, y, n);
- x = gauss(a, y, n);
- cout << " Рішення: " << endl;
- for (int i = 0; i < n; i++)
- {
- cout << "x[" << i << "]=" << x[i] << endl;
- }
- cout << "Вектор:\n";
- for (size_t i = 0; i < n; i++)
- {
- for (size_t j = 0; j < n; j++)
- {
- cout << a_copy[i][j] * x[j] - y[j] << endl;
- }
- }
- cin.get(); cin.get();
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement