c чтение из файла



считывание

Автор АндрейВыходченко задал вопрос в разделе Другие языки и технологии

[C++] Считывание из файла в массив. и получил лучший ответ

Ответ от Николай Веселуха[гуру]
#include <fstream>
#include <algorithm>
#include <ctime>
#include <iostream>
using namespace std;
int main() {
int row, col;
ifstream ifs("matrix.txt");
ifs >> row >> col;
int ** a = new int * [row];
for (int r = 0; r < row; r++, cout << endl) {
a[r] = new int [col];
for (int c = 0; c < col; c++) {
ifs >> a[r][c];
cout << a[r][c] << ' ';
}
}
for (int r = 0; r < row; r++) delete[] a[r];
delete[] a;
cin.get();
return 0;
}
Для файла вида... c чтение из файла

Ответ от DverZapili[гуру]
#include <iostream> #include <fstream> #include <string> #include <vector> using namespace std; int main() { ifstream in("filename"); vector<string> lines; string line; while

Ответ от DverZapili[гуру]
#include <iostream> #include <fstream> #include <string> #include <vector> using namespace std; int main() { ifstream in("filename"); vector<string> lines; string line; while

Ответ от 22 ответа[гуру]
Привет! Вот подборка тем с похожими вопросами и ответами на Ваш вопрос: [C++] Считывание из файла в массив.
Файловый ввод-вывод в языке Си на Википедии
Посмотрите статью на википедии про Файловый ввод-вывод в языке Си
 

Ответить на вопрос:

Имя*

E-mail:*

Текст ответа:*
Проверочный код(введите 22):*