Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Italian
  4. Classe ritorna sempre vero
Qt 6.11 is out! See what's new in the release blog

Classe ritorna sempre vero

Scheduled Pinned Locked Moved Italian
3 Posts 1 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Renzovic
    wrote on last edited by
    #1

    Ho creato questa classe, l'ho provata sul c9 e mi ritorna sempre vero.
    Qualcuno mi saprebbe dire perche'?
    C'e' qualche altro modo per scriverla magari un po' piu' professionale?
    Grazie mille

    @
    #include "festivita.h"
    #include <QDate>

    Festivita::Festivita()
    {

    }

    bool Festivita::festivo(QDate d)
    {
    // QDate d;//Data passata come parametro
    //int mese = d.month();
    int anno = d.year();
    //int giorno = d.day();
    QDate apasqua(pasqua(anno).year(),pasqua(anno).month(),pasqua(anno).day());

    if (d.day()==1 && d.month()==1)
        return(true);// Primo dell'anno
    if (d.day()==6 && d.month()==1)
        return(true);// Epifania
    if (d==apasqua.addDays(1))
    //if (d.day()==(apasqua.day()) && d.month()==apasqua.month())
       //if (d.day()==(pasqua(anno).day()) && d.month()==pasqua(anno).month())
     return(true);// Lunedi dell'Angelo
    if (d.day()==25 && d.month()==04)
        return(true);// Anniversario della liberazione
    if (d.day()==1 && d.month()==5)
        return(true);// Festa del lavoro
    if (d.day()==2 && d.month()==6)
        return(true);// Proclamazione della repubblica
    if (d.day()==29 && d.month()==6)
        return(true);// SS. Pietro e Paolo
    if (d.day()==15 && d.month()==8)
        return(true);// Assunzione
    if (d.day()==1 && d.month()==11)
        return(true);// Ognissanti
    if (d.day()==8 && d.month()==12)
        return(true);// Immacolata concenzione
    if (d.day()==25 && d.month()==12)
        return(true);// Nativita'
    if (d.day()==26 && d.month()==12)
        return(true);// S.Stefano
    

    }
    bool Festivita::soppresso(QDate d)
    {
    //int mese = d.month();
    int anno = d.year();
    //int giorno = d.day();
    QDate apasqua(pasqua(anno).year(),pasqua(anno).month(),pasqua(anno).day());
    if (d.day()==19 && d.month()==3)
    return(true);// S.Giuseppe
    if (d==apasqua.addDays(39))
    return(true);// Ascensione N.S.
    if (d==apasqua.addDays(60))
    return(true);// Corpus Domini
    if (d.day()==4 && d.month()==11)
    return(true);// Unita' Nazionale
    if (d.day()==10 && d.month()==12)
    return(true);// Madonna di Loreto
    }

    QDate Festivita::pasqua(int anno)
    {
    int a;
    int b;
    int c;
    int p;
    int q;
    int r;
    QDate dat;
    a= anno % 19;
    b=anno / 100;
    c=anno % 100;
    p = ((19 * a + b - (b / 4) - ((b - ((b + 8) / 25) + 1) / 3) + 15) % 30);
    q = ((32 + 2 * ((b % 4) + (c / 4)) - p - (c % 4)) % 7);
    r = (p + q - 7 * ((a + 11 * p + 22 * q) / 451) + 114);
    dat.setDate(anno,(r/31),((r % 31)+1));
    return dat;
    }
    @

    [Edit: @ tags; mlong]

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Renzovic
      wrote on last edited by
      #2

      Dimenticavo: sul pc funziona ma sul nokia c7 no...

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Renzovic
        wrote on last edited by
        #3

        Ok, grazie a tutti, problema risolto!!!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved