#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;
}
Объяснение:
#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;
}
Объяснение:
REM
CLS
FOR n = 1 TO 10
p = 1 * n
s = 2 * n
d = 3 * n
a = 4 * n
b = 5 * n
PRINT "1*"; n; "="; p, "2*"; n; "="; s, "3*"; n; "="; d, "4*"; n; "="; a, "5*"; n; "="; b
NEXT n
PRINT
FOR k = 1 TO 10
c = 6 * k
h = 7 * k
e = 8 * k
f = 9 * k
g = 10 * k
PRINT "6*"; k; "="; c, "7*"; k; "="; h, "8*"; k; "="; e, "9*"; k; "="; f, "10*"; k; "="; g
NEXT k
END
Объяснение: