#include "stdafx.h" #include int main() { FILE *f; FILE *fres; int n, m; f = fopen("e:\\1.txt", "r"); fres = fopen("e:\\1res.txt", "w"); fscanf(f, "%d %d", &n, &m); int **matr = (int**)calloc(n, sizeof(int*)); for (int i = 0; i < n; i++) matr[i] = (int*)calloc(m, sizeof(int)); int summa = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { fscanf(f, "%d", &matr[i][j]); summa += matr[i][j]; } fclose(f); f = fopen("e:\\1.txt", "w"); fprintf(f, "%d %d\n", n, m); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { fprintf(f, "%d ", -matr[i][j]); } fprintf(f, "\n"); } fclose(f); fputs("���� = ", fres); fprintf(fres, "%d\n", summa); for (int i = 0; i < n; i++) free(matr[i]); free(matr); fclose(fres); return 0; }