xD
uses crt;
var
dt,t1,t2:LongInt;
function GetTime:LongInt;
substr,str:string;
ERR,step,spacepos,code,num:Integer;
t:longint;
begin
ERR:=0;
repeat
t:=0;
step:=1;
if ERR<>0 then writeln('Nepravilnie dannie, povtorite vvod:');
readln(str);
str:=str+' ';
spacepos:=pos(' ',str);
if (spacepos<>0) then
substr:=copy(str,1,spacepos-1);
delete(str,1,spacepos);
val(substr,num,code);
if code=0 then
if (step=1) then begin if (num>=0) and (num<=23) then t:=t+num*60*60 else ERR:=3; end;
if (step=2) then begin if (num>=0) and (num<=59) then t:=t+num*60 else ERR:=3;end;
if (step=3) then begin if (num>=0) and (num<=59) then t:=t+num else ERR:=3;end;
inc(step);
end
else ERR:=2;
end else ERR:=1;
until ((step=4) or (err<>0));
until err=0;
GetTime:=t;
end;
writeln('pervoe vremy:');
t1:=GetTime;
writeln('vtoroe vremy:');
t2:=GetTime;
if t2>=t1 then dt:=t2-t1 else dt:=t2-t1+24*60*60;
writeln('raznica v sekundah: ');
writeln(dt);
end.
xD
uses crt;
var
dt,t1,t2:LongInt;
function GetTime:LongInt;
var
substr,str:string;
ERR,step,spacepos,code,num:Integer;
t:longint;
begin
ERR:=0;
repeat
t:=0;
step:=1;
if ERR<>0 then writeln('Nepravilnie dannie, povtorite vvod:');
ERR:=0;
readln(str);
str:=str+' ';
repeat
spacepos:=pos(' ',str);
if (spacepos<>0) then
begin
substr:=copy(str,1,spacepos-1);
delete(str,1,spacepos);
val(substr,num,code);
if code=0 then
begin
if (step=1) then begin if (num>=0) and (num<=23) then t:=t+num*60*60 else ERR:=3; end;
if (step=2) then begin if (num>=0) and (num<=59) then t:=t+num*60 else ERR:=3;end;
if (step=3) then begin if (num>=0) and (num<=59) then t:=t+num else ERR:=3;end;
inc(step);
end
else ERR:=2;
end else ERR:=1;
until ((step=4) or (err<>0));
until err=0;
GetTime:=t;
end;
begin
writeln('pervoe vremy:');
t1:=GetTime;
writeln('vtoroe vremy:');
t2:=GetTime;
if t2>=t1 then dt:=t2-t1 else dt:=t2-t1+24*60*60;
writeln('raznica v sekundah: ');
writeln(dt);
end.
! инверсия значения
& побитовое И
^ исключающее ИЛИ
| побитовое ИЛИ
7(10) = 00111(2)
11(10) = 01011(2)
21(10) = 10101(2)
25(10) = 11001(2)
31(10) = 11111(2)
11 & 7 = 01011 & 00111 = 00011
11 & !7 = 01011 & 11000 = 01000
11 & 7 | 11 & !7 = 00011 | 01000 = 01011
11 & 7 = 01011 & 00111 = 00011
!11 & 7 = 10100 & 00111 = 00100
11 & 7 | !11 & 7 = 00011 | 00100 = 00111
7 & 31 = 00111 & 11111 = 00111
(7 & 31 | (11 & 7 | !11 & 7)) = 00111 | 00111 = 00111
25 & 31 = 11001 & 11111 = 11001
25 | 25 & 31 = 11001 | 11001 = 11001
(7 & 31 | (11 & 7 | !11 & 7)) & (25 | 25 & 31) = 00111 & 11001 = 00001
31^(11 & 7 | 11 & !7) = 11111 ^ 01011 = 10100
31^(11 & 7 | 11 & !7) ^ 21 = 10100 ^ 10101 = 00001
(7 & 31 | (11 & 7 | !11 & 7)) & (25 | 25 & 31) ^ 21 = 00001 ^ 10101 = 10100
31^(11 & 7 | 11 & !7) ^ 21 | (7 & 31 | (11 & 7 | !11 & 7)) & (25 | 25 & 31) ^ 21 =
00001 | 10100 = 10101
10101(2) = 21(10)