Results 1 to 6 of 6

Thread: ++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User KeepOut's Avatar
    Join Date: Jul:2008
    Location:
    Posts: 45

    ++

    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 |

  2. #2
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    switch,
    Code:
    switch (month) {
    case 1:
    case 3:
    ...
       daysInMonth = 31;
       break;
    case 4:
    case 6:
    ...
       daysInMonth = 30;
       break;
    ...
    };
    case ( , : http://en.wikipedia.org/wiki/Leap_year#Algorithm )
    , day + 1 daysInMonth. , . 13- - .
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  3. #3
    Registered User bombov's Avatar
    Join Date: Jan:2007
    Location:
    Posts: 260
    , , , 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;
    
    	}

  4. #4
    Defender Kaspirtov's Avatar
    Join Date: Jun:2006
    Location: Sf
    Posts: 7,414
    A :
    Code:
            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;
            }
    , '89 1989 2089 , .

    :
    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;
            }
    - jd +/- .

    (, , ...) 89 = 1989 2089 , : 2089 20 .
    " , , , , ."

  5. #5
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    Quote Originally Posted by Kaspirtov View Post
    ...
    , '89 1989 2089 , .
    ...
    (, , ...) 89 = 1989 2089 , : 2089 20 .
    ( , !), 2000 . 1900 . ?
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  6. #6
    Defender Kaspirtov's Avatar
    Join Date: Jun:2006
    Location: Sf
    Posts: 7,414
    Quote Originally Posted by icaci View Post
    ( , !), 2000 . 1900 . ?
    M... . 4 . , , 2 ... 28.02.1900 +1 28.02.2000 -> 01.03.1900 29.02.2000.

    Me, icaci.
    " , , , , ."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |