Advertisement
Mikhail-Podbolotov

Untitled

Apr 24th, 2024
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include "library.h"
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     ifstream file1("input.txt");
  7.     ofstream file2("output.txt");
  8.     ifstream file3("input2.txt");
  9.     int rows, cols;
  10.     file1 >> rows >> cols;
  11.     SparseMatrix A(rows, cols);
  12.     A.Read(file1);
  13.     A.Print(file2);
  14.     file3 >> rows >> cols;
  15.     SparseMatrix B(rows, cols);
  16.     file2 << endl;
  17.     B.Read(file3);
  18.     B.Print(file2);
  19.     file2 << "SUM" << endl;
  20.     A += B;
  21.     A.Print(file2);
  22.     file2 << "DIF" << endl;
  23.     A -= B;
  24.     A.Print(file2);
  25.     file2 << "Const" << endl;
  26.     double n = 3;
  27.     A *= n;
  28.     A.Print(file2);
  29.     file2 << "Mul" << endl;
  30.     A *= B;
  31.     A.Print(file2);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement