/
VadyaS
/
file
Обзор
Документация
Войти
/
VadyaS
/
file
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
4_2DimmFileArr.cpp
40 строк
813 B
VadyaS
1_4
17 мар 2025, 13:22
17 мар 2025, 13:22
22057ed
Код
Авторство
О чём код?
#include<iostream> #include<fstream> int main() { int rows{}; int columns{}; std::ifstream file{ "in.txt"}; if (file.is_open()) { file >> rows; file >> columns; int** arr{ new int* [rows] {} }; for (int counter{}; counter < rows; counter++) { arr[counter] = new int [columns] {}; } for (int counterR{}; counterR < rows; ++counterR) { for (int counterC{}; counterC < columns; ++counterC) { file>>arr[counterR][counterC]; } } for (int counterR=rows-1; counterR >= 0; --counterR) { for (int counterC=columns-1; counterC >=0; --counterC) { std::cout << arr[counterR][counterC]<<" "; } std::cout << std::endl; } for (int k{}; k < rows; k++) { delete[] arr[k]; } delete[] arr; file.close(); } return 0; }