#include <iostream>
using namespace std;
int main()
{
const int time = 86400;
int a;
cout << "Enter the time in seconds elapsed since the beginning of the day" << endl;
cin >> a;
int hh = a % time / 3600;
int mm = a / 60 % 60;
int ss = a % 60;
int endhh, endmm, endss;
int tmp = hh * 3600 + mm * 60 + ss;
tmp = time - tmp;
endhh = tmp / 3600;
endmm = tmp / 60 - endhh * 60;
endss = tmp - endmm * 60 - endhh * 3600;
cout << "Now is: " << hh << " hh: " << mm << " mm: " << ss << " ss" << endl;
cout << "before the midnight: " << endhh << " hh: " << endmm << " mm: " << endss << " ss" << endl;
return 0;
}
Объяснение:
var a:array [1..n,1..m] of integer;
i,j,min,imin,jmin:integer;
begin
Randomize;
Writeln('Исходный массив:');
for i:=1 to n do
begin
for j:=1 to m do begin
a[i,j]:=random(21)-10;
write(a[i,j]:6);
end;
writeln;
end;
min:=a[1,1]; imin:=1;jmin:=1;
for i:=1 to n do
for j:=1 to m do
if a[i,j]<min then
begin min:=a[i,j]; imin:=i; jmin:=j; end;
writeln('min=a[',imin,',',jmin,']=',min);
end.
Пример:
Исходный массив:
5 8 2 -5 -4
1 -10 9 1 -4
8 2 -6 -4 -4
8 7 3 2 2
min=a[2,2]=-10