Results 1 to 6 of 6
Thread: ++
Hybrid View
-
13th March 2009 19:08 #1
++
switch , :
, (, , ) .
: 1 5 2007 -> 2 5 2007 , 28 2 2008 -> 29 2 2008 , 31 12 2006 -> 1 1 2007
.
| Biostar GF8200 M2+ | Athlon64x2 5200+ 2.7GHz | 2x2GB Buffalo 800MHz | Sapphire HD3650 512MB GDDR3 | 320GB HITACHI SATA2 7200rpm 16MB | 400W Fortron ATX-400PNR |
-
13th March 2009 19:40 #2
switch,
case ( , : http://en.wikipedia.org/wiki/Leap_year#Algorithm )Code:switch (month) { case 1: case 3: ... daysInMonth = 31; break; case 4: case 6: ... daysInMonth = 30; break; ... };
, day + 1 daysInMonth. , . 13- - ., . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
14th March 2009 21:19 #3
, , , 7 , , :
Code:int den; cin>>den; int mesec; cin>>mesec; int year; cin>>year; int dni=0; switch(mesec) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: dni=31; break; case 4 : case 6 : case 9 : case 11: dni=30; break; case 2: if((year%4==0 & year%100!=0) || (year%400==0)) dni=29; else dni=28; break; } den+=7; if(den>dni) { mesec+=1; if(mesec==13) { year+=1; mesec=1; den = den-dni; cout<<den<<"-"<<mesec<<"-"<<year; } else { den = den-dni; cout<<den<<"-"<<mesec<<"-"<<year; } } else { cout<<den<<"-"<<mesec<<"-"<<year; }
-
15th March 2009 12:16 #4
A :
, '89 1989 2089Code:decimal JulDate(int mm, int dd, int yy) { /* JulDate(YY, MM, DD) = DD - 32075 + 1461 * (YY + 4800 + (MM-14) / 12) / 4 + 367 * (MM - 2 - ((MM - 14) / 12) * 12) / 12 - 3 * (( YY + 4900 + (MM - 14) / 12) / 100 / 4; : YY,MM,DD , */ decimal i, j, k, j2, ju; i = yy; j = mm; k = dd; j2 = (int)((j - 14) / 12); ju = k - 32075 + (int)(1461 * (i + 4800 + j2) / 4); ju = ju + (int)(367 * (j - 2 - j2 * 12) / 12); ju = ju - (int)(3 * (int)((i + 4900 + j2) / 100) / 4); return ju; }
, .
:
- jd +/- .Code:JultoDate(decimal jd, out int mm, out int dd, out int yy) { /* */ decimal ju, i, j, k, l, n; ju = jd; l = ju + 68569; n = (int)(4 * l / 146097); l = l - (int)((146097 * n + 3) / 4); i = (int)(4000 * (l + 1) / 1461001); l = l - (int)(1461 * i / 4) + 31; j = (int)(80 * l / 2447); k = l - (int)(2447 * j / 80); l = (int)(j / 11); j = j + 2 - 12 * l; i = 100 * (n - 49) + i + l; yy = (int)i; mm = (int)j; dd = (int)k; }
(, , ...) 89 = 1989 2089 , : 2089 20 .
" , , , , ."
-
15th March 2009 12:45 #5
-
15th March 2009 12:49 #6




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in