Advertisement
dxvmxnd

Untitled

Oct 27th, 2024 (edited)
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. int** matrixReadFile(const string& path, int sizeI, int sizeJ, int** matrix) {
  2. ifstream fin(path);
  3. bool isNotCorrect;
  4. string line;
  5. int correct;
  6.  
  7. cout << "Запись матрицы..." << endl;
  8. std::getline(fin, line);
  9. std::getline(fin, line);
  10.  
  11. for (int i = 0; i < sizeI; i++) {
  12. for (int j = 0; j < sizeJ; j++) {
  13. do {
  14. isNotCorrect = false;
  15. fin >> matrix[i][j];
  16. if (fin.fail()) {
  17. isNotCorrect = true;
  18. cout << "Данные введены неккоректно. Введите " << i << "," << j << " пункт матрицы с клавиатуры." << endl;
  19. fin.clear();
  20. while (fin.get() != '\n');
  21. matrix[i][j] = exceptionRead(i, j);
  22. }
  23. }
  24. } while (isNotCorrect);
  25. }
  26. }
  27. return matrix;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement