Advertisement
Guest User

Untitled

a guest
Feb 13th, 2010
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.66 KB | None | 0 0
  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  * $Id: Zeller.c
  9.  *
  10.  * Copyright (C) 2009 Raafat Akkad
  11.  *
  12.  * This program is free software; you can redistribute it and/or
  13.  * modify it under the terms of the GNU General Public License
  14.  * as published by the Free Software Foundation; either version 2
  15.  * of the License, or (at your option) any later version.
  16.  *
  17.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  18.  * KIND, either express or implied.
  19.  *
  20.  ****************************************************************************/
  21. #include "plugin.h"
  22. int Date, Month, Year, C, S, Day;
  23. PLUGIN_HEADER
  24. enum plugin_status plugin_start(const void* parameter)
  25. {
  26.      (void)parameter;
  27.  
  28.       rb->splash(HZ*2, "Zeller's Congruence for working out the day in which a certain date occured");
  29.  
  30.       rb->splash(HZ*2, "Please Enter the date part of the date e.g");
  31.       Do
  32.  
  33.       rb->splash(HZ*2, "Please Enter the month part of the date");
  34.       it
  35.  
  36.       rb->splash(HZ*2, "Please Enter the year part of the date");
  37.       yourself!
  38.  
  39.       if (Month < 3)
  40.  
  41.       {
  42.  
  43.       Month = Month + 12;
  44.  
  45.       Year = Year - 1;
  46.  
  47.       }
  48.  
  49.       C = Year/100;
  50.  
  51.       Year = Year - (100 * C);
  52.  
  53.       S =(2.6 * Month - 5.39)+(Year / 4)+(C / 4)+ Date + Year - (2 * C);
  54.  
  55.       Day = S - (7 * (S / 7));
  56.  
  57.  
  58.       switch (Day)
  59.  
  60.       {
  61.  
  62.        case 0:
  63.  
  64.             rb->splash(HZ*2, "The date occurred on a Sunday");
  65.  
  66.             break;
  67.  
  68.        case 1:
  69.  
  70.             rb->splash(HZ*2, "The date occurred on a Monday");
  71.  
  72.             break;
  73.  
  74.        case 2:
  75.  
  76.             rb->splash(HZ*2, "The date occurred a Tuesday");
  77.  
  78.             break;
  79.  
  80.        case 3:
  81.  
  82.             rb->splash(HZ*2, "The date occurred a Wednesday");
  83.  
  84.             break;
  85.  
  86.        case 4:
  87.  
  88.             rb->splash(HZ*2, "The date occurred a Thursday");
  89.  
  90.             break;
  91.  
  92.        case 5:
  93.  
  94.             rb->splash(HZ*2, "The date occurred a Friday");
  95.  
  96.             break;
  97.  
  98.        case 6:
  99.  
  100.             rb->splash(HZ*2, "The date occurred a Saturday");
  101.             break;
  102.        case 7:
  103.  
  104.             rb->splash(HZ*2, "The date occurred a Sunday");
  105.  
  106.             break;
  107.  
  108.        break;
  109.  
  110.       }
  111.  
  112.         rb->splash(HZ*2, "Goodbye");
  113.     return PLUGIN_OK;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement