Утре коя дата ще е

При въвеждане на дата да изведе кой е следващия ден (коя дата)

Публикувано в 11а, 11в с етикети . Постоянна връзка.

4 Responses to Утре коя дата ще е

  1. SvetoslavaPamela каза:
     
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        int den,mesec,godina,posleden_den;
        cout<<"Vuvedete den,mesec,godina: ";
        cin>>den>>mesec>>godina;
        switch (mesec) {
            
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10: 
        case 12: posleden_den=31; break;
        case 2: posleden_den=28; break;
        case 4:
        case 6:
        case 9:
        case 11: posleden_den=30; break; 
    }
        if (den==posleden_den)
            if (mesec==12) {
                godina=godina+1;
                mesec=1;
                den=1;
            }
            else {
            mesec=mesec+1;
            den=1;
        }
        else
        den=den+1;
        
        cout<<"Denqt e: "<<den<<endl;
        cout<<"Mesecut e: "<<mesec<<endl;
        cout<<"Godinata e: "<<godina<<endl;
            
            
        system("PAUSE");
        return EXIT_SUCCESS;
    }
    
  2. maleboldjia каза:

    а задължително ли е да бъде със „case“ ?

  3. Gadget каза:
    
    int d,m,m1,g;
        cout<<"Vavedete datata (Den,Mesec i Godina v tzifri):"<<endl;
        cin>>d>>m>>g;
        cout<<"Utreshnata data e: ";
        d=d+1;
                                                      
              if(((d>0)&&(d<33))&&((m>0)&&(m<=12))){
                  switch(m){
                  //Preglejdame masecite po broi dni
                     case 2:if((d>0)&&(d<=30)){
                                if(((g%4==0)&&(d==30))||(d==29)){
                                   if(d==30){
                                      cout<<"Purvi Mart ";
                                      }
                                     else
                                   if((d==29)&&(g%4!=0)){
                                         cout<<"Purvi Mart ";}
                                        else
                                         cout<<"Dvadeset i deveti Fevruari";
                                }
                          }
                           else
                           cout<<"Nevalidna data!"<<endl;break;
                     case 1:
                     case 3:
                     case 5:
                     case 7:
                     case 8:
                     case 10:
                     case 12:if(d==32)
                         m=m+1;break;    
                     case 4:
                     case 6:
                     case 9:
                     case 11:if(d<=31){
                            if(d<31){
                            m=m;}
                            else{
                               m=m+1;
                                 cout<<"Purvi ";}
                         }
                         else
                         cout<<"!!! Nevaliden den ot meseca !!!";break;
                     default:cout<<"Ne sushtestvuva takuv mesetz!"<<endl;
                     } 
                                                            
         switch(d){
         //Naimenovame denqt    
             case 1:cout<<"Purvi ";break; 
             case 2:cout<<"Vtori ";break;
             case 3:cout<<"Treti ";break;
             case 4:cout<<"Chetvurti ";break;
             case 5:cout<<"Peti ";break;
             case 6:cout<<"Shesti ";break;
             case 7:cout<<"Sedmi ";break;
             case 8:cout<<"Osmi ";break;
             case 9:cout<<"Deveti ";break;
             case 11:cout<<"Edinadeseti ";break;
             case 12:cout<<"Dvanadeseti ";break;
             case 13:cout<<"Trinadeseti ";break;
             case 14:cout<<"Chetirinadeseti ";break;
             case 15:cout<<"Petnadeseti ";break;
             case 16:cout<<"Shestnadeseti ";break;
             case 17:cout<<"Sedemnadeseti ";break;
             case 18:cout<<"Osemnadeseti ";break;
             case 19:cout<<"Devetnadeseti ";break;
             case 20:cout<<"Dvadeseti ";break;
             case 21:cout<<"Dvadeset i purvi ";break;
             case 22:cout<<"Dvadeset i vtori ";break;
             case 23:cout<<"Dvadeset i treti ";break;
             case 24:cout<<"Dvadeset i chetvurti ";break;
             case 25:cout<<"Dvadeset i peti ";break;
             case 26:cout<<"Dvadeset i shesti ";break;
             case 27:cout<<"Dvadeset i sedmi ";break;
             case 28:cout<<"Dvadeset i osmi ";break;
             case 29:if(m==2){
                        cout<<" ";}
                     else
                        cout<<"Dvadeset i deveti ";break;
             case 30:if(m==2){
                        cout<<" ";}
                     else
                        cout<<"Trideseti ";break;
             case 31:if(((m==5)||(m==7)||(m==10)||(m==12))&&(d==31)){
                       cout<<" ";break;}
                    else
                       cout<<"Trideset i purvi ";break;
             case 32:cout<<"Purvi ";break;
             default:cout<<"Nevalidna data"<<endl;
             }
             
           
                  switch(m){
                  //Naimenovame mesecite
                     case 1:cout<<"Qnuari ";break;
                     case 2:if((d>28)&&(d<=30)){
                                cout<<" ";}
                               else
                                cout<<"Fevruari ";break;
                     case 3:cout<<"Mart ";break;
                     case 4:cout<<"April ";break;
                     case 5:cout<<"Mai ";break;
                     case 6:cout<<"Iuni ";break;
                     case 7:cout<<"Iuli ";break;
                     case 8:cout<<"Avgust ";break;
                     case 9:cout<<"Septemvri ";break;
                     case 10:cout<<"Oktomvri ";break;
                     case 11:cout<<"Noemvri ";break;
                     case 12:cout<<"Dekemvri ";break;
                     case 13:cout<<"Qnuari ";break;
                     default:cout<<"Nevaliden mesec "<<endl;
                     }
                     //Otpechatvame godinata
                     if((d==32)&&(m==13))
                     cout<<g+1<<" Godina! "<<endl;
                     else
                     cout<<g<<" Godina! "<<endl;
            } 
            else
            cout<<"Nevalidna data!"<<endl; 

    Reshenie na zadachata s dumi!

Вашият коментар