Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   Помогите (C++) (https://forum.antichat.xyz/showthread.php?t=102273)

Gen1rus 20.01.2009 20:34

Помогите (C++)
 
Создать программу, обеспечивающую ввод пользователем 10 строк с клавиатуры, запись этих строк в файл и последующее чтение из файла.

З.Ы. Борланд С++, консоль

Gen1rus 20.01.2009 20:57

up

herfleisch 20.01.2009 21:10

Пиши мне в асю. Приеду домой - помогу.

Chaak 20.01.2009 21:51

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 010i++)
        {
            
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;




Время: 14:28