Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Rus");
- bool isThere = false;
- int** array;
- array = new int* [4];
- for (int i = 0; i < 4; i++) {
- array[i] = new int[4];
- }
- cout << "Enter numbers\n";
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < 4; j++) {
- cout << "array [" << i + 1 << "][" << j + 1 << "] = ";
- cin >> array[i][j];
- }
- }
- cout << endl;
- for (int i = 0; i < 4; i++) {
- cout << endl;
- for (int j = 0; j < 4; j++) {
- cout << array[i][j] << " ";
- }
- }
- int mult = 1;
- for (int i = 1; i < 4; i++) {
- if (array[0][i] < 0) {
- mult *= array[0][i];
- isThere = true;
- }
- }
- for (int i = 2; i < 4; i++) {
- if (array[1][i] < 0) {
- mult *= array[1][i];
- isThere = true;
- }
- }
- if (array[2][3] < 0) {
- mult *= array[2][3];
- isThere = true;
- }
- if (isThere) {
- for (int i = 0; i < 4; i++) {
- array[i][i] += mult;
- }
- for (int i = 0; i < 4; i++) {
- cout << endl;
- for (int j = 0; j < 4; j++) {
- cout << array[i][j] << ' ';
- }
- }
- }
- else {
- cout << "\nТаких значений нет";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment