На с++ дан файл. удалить из него третью строку. результат записать в другой файл.
272
482
Ответы на вопрос:
#include < iostream> #include < fstream> #include < string> #include < vector> #include < iterator> using namespace std; int main() { vector< string> str; string text; ifstream fin("a.txt"); while (getline(fin, text)) { str.push_back(text); } fin.close(); str.erase(str.begin() + 2); ofstream fout("b.txt"); copy(str. str. ostream_iterator< string> (fout, "\n")); fout.close(); system("pause"); return 0; }
Популярно: Информатика
-
xcp431.08.2021 16:33
-
khadeevaelena27.11.2022 10:15
-
katirina61171Rfn16.07.2020 00:11
-
xXDeXTeRXx26.04.2021 05:31
-
Max0403200324.04.2022 23:05
-
Сашенька22808.03.2023 19:41
-
daryasergeryna08.10.2021 09:50
-
krudnya27.04.2020 11:21
-
kek20057019.01.2022 13:49
-
AlexanraMexx07.07.2020 16:49