Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. void toFile(int** MX, int n) {
  2.  
  3.     ofstream fout;
  4.  
  5.     string path = "C:\\Users\\MSI\\Desktop\\ETU\\прога\\Вывод матрицы.txt";
  6.  
  7.     fout.open(path);
  8.     if (!fout.is_open())
  9.     {
  10.         cout << "Ошибка открытия файла" << endl;
  11.     }
  12.     else {
  13.         fout << "Наша матрица" << endl;
  14.         for (int i = 0; i < n; i++)
  15.         {
  16.             for (int j = 0; j < n; j++)
  17.             {
  18.                 fout << setw(n) << right << MX[i][j] << " ";
  19.             }
  20.             fout << endl;
  21.         }
  22.     }
  23.    
  24.  
  25.     fout.close();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement