Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project8;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- function FindingFile(): String;
- var
- CorrectFile: Boolean;
- NameOfFile, Str: String;
- Input: TextFile;
- begin
- repeat
- Write('Введите путь к файлу, с которого хотите считать информацию :');
- Readln(NameOfFile);
- CorrectFile := True;
- try
- AssignFile(Input, NameOfFile);
- Reset(Input);
- if not eof(Input) then
- begin
- Read(Input, Str);
- CloseFile(Input);
- end
- else
- begin
- WriteLn(' Файл оказался пустым ');
- CloseFile(Input);
- end;
- except
- CorrectFile := False;
- WriteLn('Не удалось найти файл по такому пути', NameOfFile);
- end;
- until CorrectFile;
- FindingFile := Str;
- end;
- function CharacterInsertion(Str: String): String;
- var
- i: integer;
- begin
- for i := Str.Length downto 0 do
- begin
- if (Str[i] in ['a', 'u', 'e', 'o', 'y', 'i']) then
- begin
- Insert('*', Str, i + 1);
- end;
- end;
- CharacterInsertion := Str ;
- end;
- procedure SaveFile(NameOutput: String; Str : String);
- var
- Output: TextFile;
- begin
- WriteLn('Введите путь к файлу для записи : ');
- Readln(NameOutput);
- AssignFile(Output, NameOutput);
- Rewrite(Output);
- WriteLn(Output, ' Новая строка : ', Str);
- CloseFile(Output);
- Readln;
- end;
- var
- k: integer;
- NameOutput: String;
- Str : String;
- begin
- Write('Дана строка символов , состоящая из произвольного текста на английском языке , слова разделены пробелом.');
- WriteLn('После каждого гласного символа вставить символ " * " ');
- Str := FindingFile();
- Str := CharacterInsertion(Str);
- SaveFile(NameOutput, Str);
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment