Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
15
Добавлен:
10.12.2013
Размер:
1.28 Кб
Скачать
(*
This program is used to count the number of vowels and the total number of
characters in the input file.
NOTE: This program makes use of two features of Irie Pascal
1) If the user does not specify a command-line parameter to match the
program argument 'f' then 'f' is automatically assigned an empty string
as it's filename.
2) If a file variable with an empty string as it's filename is reset then
the standard input file is associated with the file variable.

The net effect of these two features is that if you run this program and
don't supply a program argument like "ivm vowels" then the program reads
from the standad input file. If you run this program with a program argument
like "ivm vowels filename" then the program will open "filename" and read
from it.
*)
program vowels(f, output);
var
f : file of char;
tot, vow : integer;
c : char;
begin
reset(f);
tot := 0;
vow := 0;
while not eof(f) do
begin
read(f, c);
case c of
'a', 'e', 'i', 'o', 'u',
'A', 'E', 'I', 'O', 'U'
: vow := vow + 1;
otherwise
end;
tot := tot + 1;
end;
writeln('Total characters read = ', tot);
writeln('Vowels read = ', vow)
end.
Соседние файлы в папке samples