Предмет: Информатика, автор: Litlle228

Дан текстовый файл. Найти количество вхождений данного символа в текстовом файле. На паскале! ​

Ответы

Автор ответа: pinguinbird
2

Ответ:

var x,s:string;

   f:Text;

   path:string = 'f:\file.txt';

   i, counter:integer;

begin

   write('Какой символ искать: '); readln(s);

   x:='';

   assign(f, path);

   reset(f);

   while not eof(f) do begin

       while not eoln(f) do begin

           readln(f, x);  

           for i:=1 to Length(x) do begin

               if x[i] = s then inc(counter)

           end;

       end;

   end;

   write('Количество таких символов в файле: ', counter);

end.


Litlle228: переменная х-это строка в файле? а переменная s-это символ в строке?
Litlle228: и что значит x:=""
pinguinbird: переменная х-это строка в файле? а переменная s-это символ в строке? - Ага
pinguinbird: и что значит x:="" просто инициализация строковой переменной
Интересные вопросы
Предмет: Английский язык, автор: zhmurkin06p457bl
                          КТО МОЖЕТ
                                                    РЕШИТЕ ПО 1 ЗАДАНИЮ



 

1. Вычеркни лишнее слово: 1) going, helping, ding, playing, sit; 2) wash, watch, cleaning, like, read; 3) running, taking, getting, jogging, knitting; 4) playing, coming, arranging, making, dancing; 5) went, did, corrected, slept, saw.     


2. Обведи правильный глагол: 1. Vets help/ are helping sick animals. 2. Look! The girl dances/ is dancing now. 3. The girls usually dance/ are dancing. 4. Listen! She plays/ is playing a piano. 5. What are you doing? - I watch/ am watching a very good film now     



3. Открой скобки: Look at the photo of my family. My mother … … (to read) a book. My sister and my brother … … (to watch) TV. My father … … (to play) computer games. My Granny and my Granddad … … (to talk) at the moment. My dog … … (to sleep). My cat … … (to run) over the room. What am I doing? I … … (to write) my homework!    


4. Используй Present Simple или Present Progressive: 1. They (to play) tennis now. 2. We (to play) tennis every day. 3. Where is Jane? – She (to read) a new book in her room. 4. Sam usually (to read) magazines in the evening. 5. I (to write) a letter to my sister now. 6. I (to write) a letter to my Granny once a month         


5. Составить 5 предложений в Present Simple и 5 предложений в Present Progressive