От того какой он и что в нем
Ответ:
program Test;
const
L = ['а'..'я', 'А'..'Я'];
N = ['0'..'9'];
var
f: Text;
s: AnsiString;
cl, cn, i: Integer;
begin
Assign (f, 'text.txt'); // здесь название файла
Reset (f);
cl := 0;
cn := 0;
while not Eof (f) do begin
ReadLn (f, s);
for i := 1 to Length (s) do begin
if s [i] in L then
Inc (cl)
else if s [i] in N then
Inc (cn);
end;
end;
Close (f);
WriteLn ('Русских букв: ', cl);
WriteLn ('Цифр: ', cn);
ReadLn;
end.
Объяснение:
текстовый файл должен находиться в папке с программой, иначе укажите полный путь к нему. Кодировка файла ANSI - кириллица 1251 или OEM -русский 866.
static void Main()
{
foreach (string s in Console.ReadLine().Split(' '))
if (s.IndexOf('k') > -1)
Console.Write(s + ' ');
Console.ReadLine();
}