Создать программу, обеспечивающую ввод пользователем 10 строк с клавиатуры, запись этих строк в файл и последующее чтение из файла. З.Ы. Борланд С++, консоль
PHP: #include <iostream> #include <string> #include <fstream> #include <conio.h> using namespace std; int main() { setlocale(LC_ALL, "Russian"); ofstream ufile; string uinput; cout<<"Введите 10 строк: "<<endl; ufile.open("file.txt", ios::app); if(ufile.is_open()) { for(int i = 0; i < 10; i++) { cin>>uinput; ufile<<uinput<<"\n"; } ufile.close(); } else { cout<<"Ошибка открытия файла!"; } system("cls"); cout<<"Содержимое: "<<endl<<endl; ifstream ufiler; ufiler.open("file.txt"); if(ufiler.is_open()) { while(!ufiler.eof()) { ufiler>>uinput; cout<<uinput<<endl; } ufiler.close(); } else { cout<<"Ошибка открытия файла!"; } _getch(); return 0; }