13.05.2017, 13:35 | #1 (permalink) |
Новичок
Регистрация: 13.05.2017
Сообщений: 2
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 10
|
Pascal. Вывод строк в другой файл
|
13.05.2017, 13:35 | |
Helpmaster
Member
Регистрация: 08.03.2016
Сообщений: 0
|
Рекомендую не терять времени, а ознакомиться с похожими топиками Обработка символов и строк на языке Pascal Pascal ABC: File23. Дан файл вещественных чисел, создать файл целых чисел Pascal ABC, записи, нужен вывод отсортированной строки Можно ли торрент-файл ISO открыть другой программой? Вывод звука через другой выход |
13.05.2017, 14:12 | #2 (permalink) | |
Специалист
Регистрация: 27.08.2008
Адрес: Санкт-Петербург
Сообщений: 27,807
Сказал(а) спасибо: 340
Поблагодарили 583 раз(а) в 208 сообщениях
Репутация: 113184
|
Цитата:
Например, так (имена и адреса файлов поставьте, конечно, свои): Код:
Var f1,f2:Text; i,N:byte; S:String; Begin Assign(f1,'D:\in.txt'); Reset(f1); Assign(f2,'D:\out.txt'); Rewrite(f2); N:=1; Repeat Readln(f1,S); if Not(EoF(f1)) then Inc(N); Until EoF(f1); Repeat Reset(f1); for i:=1 to N do Readln(f1,S); Writeln(f2,S); Dec(N); Until N=0; Close(f1); Close(f2); End. файл in.txt: Friends, Romans, countrymen, lend me your ears; I come to bury Caesar, not to praise him. The evil that men do lives after them; The good is oft interred with their bones; So let it be with Caesar. The noble Brutus Hath told you Caesar was ambitious: If it were so, it was a grievous fault, And grievously hath Caesar answer'd it. Here, under leave of Brutus and the rest - For Brutus is an honourable man; So are they all, all honourable men - Come I to speak in Caesar's funeral. He was my friend, faithful and just to me: But Brutus says he was ambitious; And Brutus is an honourable man. He hath brought many captives home to Rome Whose ransoms did the general coffers fill: Did this in Caesar seem ambitious? When that the poor have cried, Caesar hath wept: Ambition should be made of sterner stuff: Yet Brutus says he was ambitious; And Brutus is an honourable man. You all did see that on the Lupercal I thrice presented him a kingly crown, Which he did thrice refuse: was this ambition? Yet Brutus says he was ambitious; And, sure, he is an honourable man. I speak not to disprove what Brutus spoke, But here I am to speak what I do know. You all did love him once, not without cause: What cause withholds you then, to mourn for him? O judgment! thou art fled to brutish beasts, And men have lost their reason. Bear with me; My heart is in the coffin there with Caesar, And I must pause till it come back to me. файл out.txt: And I must pause till it come back to me. My heart is in the coffin there with Caesar, And men have lost their reason. Bear with me; O judgment! thou art fled to brutish beasts, What cause withholds you then, to mourn for him? You all did love him once, not without cause: But here I am to speak what I do know. I speak not to disprove what Brutus spoke, And, sure, he is an honourable man. Yet Brutus says he was ambitious; Which he did thrice refuse: was this ambition? I thrice presented him a kingly crown, You all did see that on the Lupercal And Brutus is an honourable man. Yet Brutus says he was ambitious; Ambition should be made of sterner stuff: When that the poor have cried, Caesar hath wept: Did this in Caesar seem ambitious? Whose ransoms did the general coffers fill: He hath brought many captives home to Rome And Brutus is an honourable man. But Brutus says he was ambitious; He was my friend, faithful and just to me: Come I to speak in Caesar's funeral. So are they all, all honourable men - For Brutus is an honourable man; Here, under leave of Brutus and the rest - And grievously hath Caesar answer'd it. If it were so, it was a grievous fault, Hath told you Caesar was ambitious: So let it be with Caesar. The noble Brutus The good is oft interred with their bones; The evil that men do lives after them; I come to bury Caesar, not to praise him. Friends, Romans, countrymen, lend me your ears; |
|
13.05.2017, 14:18 | #4 (permalink) |
Специалист
Регистрация: 27.08.2008
Адрес: Санкт-Петербург
Сообщений: 27,807
Сказал(а) спасибо: 340
Поблагодарили 583 раз(а) в 208 сообщениях
Репутация: 113184
|
|
Ads | |
Member
Регистрация: 31.10.2006
Сообщений: 40200
Записей в дневнике: 0
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 55070
|
|
|