Ну практически во всех операционных системах имеется одноименная команда ping. Вводится эта команда в терминале, эмуляторе терминала, консоли, командной строке и т.п. Пример:
PING 192.168.1.24 (192.168.1.24): 56 data bytes
64 bytes from 192.168.1.24: icmp_seq=0 ttl=64 time=2.035 ms
64 bytes from 192.168.1.24: icmp_seq=1 ttl=64 time=0.581 ms
64 bytes from 192.168.1.24: icmp_seq=2 ttl=64 time=0.725 ms
64 bytes from 192.168.1.24: icmp_seq=3 ttl=64 time=0.561 ms
У меня в сети нет хоста с адресом
<span>192.168.104.1, поэтому продемонстрировал работу программы на имеющемся хосте.
Если хоста с таким адресом нет или он не отвечает, то получим такой вывод работы программы:
PING 192.168.104.1 (192.168.104.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4</span>
1)
var
a, b, c, d, max: integer;
begin
readln(a, b, c, d);
if(a > b) and (a > c) and (a > d) then max := a
else if(b > a) and (b > c) and (b > d) then max := b
else if(c > a) and (c > b) and (c > d) then max := c
else max := d;
write(max);
end.
2)
var
a, b, c, max:
integer;
begin
readln(a, b, c);
if(a > b) and (a > c) then max := a
else if(b > a) and (b > c) then max := b
else max := c;
write(max);
end.
Var
n,k:integer;
Begin
Write('Введите n и k: ');
Readln(n,k);
if n = k then write(n) else
if n>k then write('N - max') else write('K - max');
End.
//Pascal ABC.NET 3.1 сборка 1219
Const
n=10;
Var
c,i,k:integer;
ar:array[1..n] of integer;
r:real;
begin
readln(c);
writeln('Array:');
for i:=1 to n do
begin
ar[i]:=random(-43,34);
if ar[i]>c then
begin
inc(k);
r:=r+ar[i];
end;
write(ar[i]:4);
end;
writeln;
r:=r/k;
write(r);
end.
Пример ввода:
0
Пример вывода:
Array:
20 -23 23 18 -40 -16 -39 31 -12 21
22.6