Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
689 B
0
Indexable
Never
#include <iostream>
using namespace std;
int main() {
	float mas[100][100];
	int t; int l,k;
	char a; int b, c;
	cin >> l >> k; cin >> t;
	for (int i = 0; i < l; i++){
		for (int j = 0; j < k; j++) {
			cin >> mas[i][j];
		}
	}
	for (int i = 0; i < t; i++) {
		cin >> a >> b >> c;
		for (int j = 0; j < l; j++){
			if (a == '+') {
				mas[j][c] += mas[j][b];
			}
			if (a == '/') {
				mas[j][c] /= mas[j][b];
			}
			if (a == '*') {
				mas[j][c] *= mas[j][b];
			}
			if (a == '-') {
				mas[j][c] -= mas[j][b];
			}
		}
		for (int j = 0; j < l; j++){
			for (int m = 0; m < k; m++){
				cout << mas[j][m] <<' ';
			}
			cout << '\n';
		}

	}



}