///////////////////////////////////////////////////// // Sylvain Marechal // Outils pour la gestion des calendriers // 14/11/2003 ///////////////////////////////////////////////////// #include #include #include "calend.h" // On declare cette fonction static car // on en a pas besoin a l'exterieur de calend.cpp static void Corrections( int & M, int & A ) { if( M < 3 ) { M = M + 12; A = A - 1; } } // Idem pour static static int CodeDuJour( int J, int M, int A ) { // Correction de mois et annee (passage par reference) Corrections( M, A ); int N = J + (2*M) + (0.6*(M+1)) + A + (A/4) - (A/100) + (A/400); return N; } int NumJourSemaine( int J, int M, int A ) { int N = CodeDuJour( J, M, A ); int R = N - 7 * (N/7) + 1; return R; } int Bissextile( int annee ) { if( annee % 4 == 0 ) { if( annee % 400 == 0 ) return 1; if( annee % 100 == 0 ) return 0; return 1; } return 0; }