fidonet:clang.ita
Differences
This shows you the differences between two versions of the page.
fidonet:clang.ita [30/12/2024 06:13] – created lrosa | fidonet:clang.ita [30/12/2024 14:27] (current) – lrosa | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CLANG.ITA ====== | ||
+ | ===== Descrizione ===== | ||
+ | Area italiana dedicata al linguaggio C. | ||
+ | ===== Messaggi interi ===== | ||
+ | ==== Re: Struttura messaggi OPUS ==== | ||
+ | < | ||
+ | 09 Nov 89 15:54:00 | ||
+ | From: | ||
+ | To: Luigi Rosa | ||
+ | Subj: Re: Struttura messaggi OPUS | ||
+ | ------------------------------------------------ | ||
+ | Ah sì? Ma Opus Pavia è in rete? Se sì, è quello di Martinelli? | ||
+ | |||
+ | Ciao | ||
+ | |||
+ | --- ITALMAIL v2.06 | ||
+ | * Origin: ITALINK CBBS Montecastello (0131-355506) | ||
+ | </ | ||
+ | ==== FORMULA PER CALCOLO N.SETTIMANE ==== | ||
+ | < | ||
+ | ============================================================================= | ||
+ | * Area : CLANG.ITA (Linguaggio C) | ||
+ | * From : Salvatore Manzi, 2:332/108.7 (02 Apr 91 20:01) | ||
+ | * To : Duncan Wilcox | ||
+ | * Subj : Congruenza di Zeller | ||
+ | ============================================================================= | ||
+ | |||
+ | // by Jeff Duntemann | ||
+ | // | ||
+ | // calc_day_of_week calculates the day of the week using | ||
+ | // | ||
+ | // where 0 = Sunday, 1 = Monday, and so on. | ||
+ | // | ||
+ | |||
+ | int calc_day_of_week(int year, | ||
+ | int month, | ||
+ | int day) | ||
+ | |||
+ | { | ||
+ | int century, holder; | ||
+ | |||
+ | // First test for error conditions on input values: | ||
+ | if ((year < 0) || // Test for bad year | ||
+ | (month < 1) || (month > 12) || // Test for bad month | ||
+ | (day < 1) || (day > 31)) // Test for bad day | ||
+ | | ||
+ | else | ||
+ | /* Do the Zeller' | ||
+ | /* described it in "Acta Mathematica" | ||
+ | { | ||
+ | // First we separate out the year and the century figures: | ||
+ | century = year / 100; // I.e., 19 | ||
+ | year = year % 100; // I.e., 90 | ||
+ | |||
+ | // Next we adjust the month such that March remains month #3, | ||
+ | // but that January and February are months #13 and #14, | ||
+ | // *but of the previous year*. | ||
+ | // weirdness of February at the *end* of the " | ||
+ | |||
+ | if (month < 3) // Do this only for January & February! | ||
+ | { | ||
+ | month += 12; // Increment month by 12 | ||
+ | if (year > 0) // The year before 2000 is | ||
+ | year -= 1; // | ||
+ | else // | ||
+ | { // we decrement the century | ||
+ | year = 99; // | ||
+ | century -= 1; | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | // Here's Zeller' | ||
+ | holder = day; // Start with the day of month | ||
+ | |||
+ | // This is a magic pill that figures the number of days that occur | ||
+ | // prior to the start of the current month from *MARCH 1*: | ||
+ | holder = holder + (((month+1) * 26) / 10); | ||
+ | |||
+ | holder = holder + year; // Add in the year | ||
+ | holder = holder + (year / 4); // Correct for leap years | ||
+ | holder = holder + (century / 4); // Correct for century years | ||
+ | holder = holder - century - century; // DON'T KNOW WHY HE DID THIS! | ||
+ | |||
+ | // modulus non fa altro che calcolare il modulo, non e' di libreria e per | ||
+ | // l'ho tolta | ||
+ | holder = modulus(holder, | ||
+ | |||
+ | // Here we " | ||
+ | if (holder == 0) | ||
+ | holder = 7; | ||
+ | |||
+ | // Zeller kept the Sunday = 1 origin; computer weenies prefer to | ||
+ | // start everything with 0, so here's a 20th Century kludge: | ||
+ | holder--; | ||
+ | |||
+ | return holder; | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | Nel tuo Main bastera' | ||
+ | </ | ||