@Леди1
0 / 0 / 0
Регистрация: 01.11.2012
Сообщений: 14
|
|
|
01.11.2012, 14:48. Просмотров 869. Ответов 0
Помогите пожалуйста:
Pascal | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| program TextFile;
uses
Crt;
var
F1, F2: Text;
CharCount, WordCount, LineCount: Integer;
i: Integer;
s: String;
c: Char;
f: Boolean;
begin
Assign (F1, 'my.txt');
Assign (F2, 'stat.txt');
Reset (F1);
Rewrite (F2);
CharCount := 0;
WordCount := 0;
LineCount := 0;
while not EOF (F1) do begin
readln (F1, s);
Inc (LineCount);
Inc (CharCount, Length (s));
f := True;
for i := 1 to Length (s) do begin
if (s[i] <> ' ') and f then begin
Inc (WordCount);
f := False;
end;
if (s[i] = ' ') and (not f) then begin
f := True;
end;
end;
writeln (s);
c := readkey;
end;
writeln (F2, 'Символов: ', CharCount);
writeln (F2, 'Слов: ', WordCount);
writeln (F2, 'Абзацев: ', LineCount);
Close (F1);
Close (F2);
end. |
|
Вот моя программа дальше не знаю как:
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| #include <conio.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
FILE *F1,*F2;
int CharCount, WordCount, LineCount,i;
string s;
char c;
bool f;
{
F1 = fopen("my.txt","rt");
F2 = fopen("stat.txt","wt");
CharCount = 0;
WordCount = 0;
LineCount = 0;
while (!feof(F1))
{.... |
|
0
|