Like Tree7Likes

Christmas with a capital C...

This is a discussion on Christmas with a capital C... within the General Discussions forums, part of the Community Boards category; It's your Christmas card. Copy, compile, enjoy... Code: // The 12 days of christmas C style #include <stdio.h> int main ...

  1. #1
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547

    Christmas with a capital C...

    It's your Christmas card.
    Copy, compile, enjoy...

    Code:
    // The 12 days of christmas C style
    #include <stdio.h>
    
    int main (void)
      { int day; 
        char days[12][12] = {"first", "second", "third", "fourth", "fifth", "sixth",
                          "seventh", "eighth", "nineth", "tenth", "eleventh", "twelth" };
    
        do
          {
            printf("Which day of Christmas is it? (1 - 12) : ");
            scanf("%d",&day);
            while(getchar() != '\n');
          }  
        while((day < 1) || (day > 12)); 
     
        printf("\n\nOn the %s day of Christmas my true love gave to me...\n",days[day-1]);
    
        switch(day) 
          {
            case 12 :
              printf("\t12 drummers drumming\n");
            case 11 :
              printf("\t11 pipers piping\n");
            case 10 :
              printf("\t10 lords a leaping\n");
            case 9 :
              printf("\t9 ladies dancing\n");
            case 8 :
              printf("\t8 maids a milding\n");
            case 7 :
              printf("\t7 swans a swimming\n");
            case 6 :
              printf("\t6 geese a laying\n");
            case 5 :
              printf("\t5 GOLDEN RINGS\n");
            case 4 :
              printf("\t4 calling birds\n");
            case 3 :
              printf("\t3 french hens\n");
            case 2 :
              printf("\t2 turtle doves\n");
            case 1 :
              if (day > 1)
                printf("\t...and...\n");
              printf("\ta partrige in a pear tree!\n");
          }
    
        printf("\nHappy holidays to all on CProgramming!\n");
        return 0;
      }
    Last edited by CommonTater; 12-18-2011 at 10:24 PM.
    MK27 and Epy like this.

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,299
    Where I'm from, the song goes like this:
    Code:
    case 12 :
      printf("\t12 piupius swinging\n");
    case 11 :
      printf("\t11 haka lessons\n");
    case 10 :
      printf("\t10 juicy fish heads \n");
    case 9 :
      printf("\t9 sacks of pipis\n");
    case 8 :
      printf("\t8 plants of puha\n");
    case 7 :
      printf("\t7 eels a swimming\n");
    case 6 :
      printf("\t6 pois a twirling\n");
    case 5 :
      printf("\t5 - BIG - FAT - PIGS !\n");
    case 4 :
      printf("\t4 huhu grubs\n");
    case 3 :
      printf("\t3 flax kits\n");
    case 2 :
      printf("\t2 kumara\n");
    case 1 :
      if (day > 1)
        printf("\t...and...\n");
      printf("\ta pukeko in a ponga tree!\n");
    http://www.mamalisa.com/?t=es&p=249&c=40
    MK27 likes this.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Then I can only suggest you come from a very bizarre place...
    laserlight likes this.

  4. #4
    language hopper dennis.cpp's Avatar
    Join Date
    Jan 2011
    Location
    Herborn, Hesse, Germany
    Posts
    197
    Not that I don't enjoy Christmas, seeing it rather as a nice tradition than a religious holiday, but just for interest: Is there any atheist equivalent to Christmas? Since there is some kind of equivalent in almost any other religion?
    Hardware: Intel® Core™ i7-3630QM CPU @ 2.40GHz × 8
    Operating system: Fedora 19 (64-Bit) / Linux 3.11.6-200.fc19 / KDE SC 4.11.2
    Compiler: gcc 4.8.2 with Netbeans IDE 7.4

  5. #5
    Registered User
    Join Date
    Nov 2011
    Location
    Douala, Cameroon
    Posts
    187

    Cool freethinkers club

    what about some of us in the freethinking club that think religion is a myth as S. Freud says "The fear of the father story that originated this mystery.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Oh WOW... I send a cute little holiday greeting to people I've been talking to all year
    and you turn it into a debate about religion and tradition...

    What is wrong with you people?

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Kwanzaa is non-religious, but it is not specifically atheist and I think a lot of people who practice it are also members of one religion or another.

    I've been an atheist since I was about 8 but I still love Christmas. I don't need much of an excuse for merry making, but having people join you in it can be special. Never miss an opportunity for a feast.

    Also: it makes a lot of sense to me that Xmas largely derives from, or at least gained popularity because of, ancient "pagan" ceremonies marking the winter solstice. Which I consider solstices important, non-religious events. The longest night of the year and all.
    Last edited by MK27; 12-19-2011 at 08:10 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    Registered User
    Join Date
    Nov 2011
    Location
    Douala, Cameroon
    Posts
    187

    Thumbs down is_true

    yeah i just thought this may be a spice to the christmas holidays .. any way you got a point this is not a chatroom. This is a classroom. so guys lets get back to programming.

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Nyah Check View Post
    yeah i just thought this may be a spice to the christmas holidays .. any way you got a point this is not a chatroom. This is a classroom. so guys lets get back to programming.
    You think that setting people off arguing religion and politics is a "way to spice up the christmas holidays"?
    Well, let me just add that I'm real glad you're not coming to dinner!

    And this isn't a classroom either...
    There are no teachers here and it's not any of our jobs to teach programming.
    This is simply a place where people volunteer their time to help others debug their code.


    Again... Happy Holidays to all reading.
    Over and Out.

  10. #10
    language hopper dennis.cpp's Avatar
    Join Date
    Jan 2011
    Location
    Herborn, Hesse, Germany
    Posts
    197
    Quote Originally Posted by CommonTater View Post
    Oh WOW... I send a cute little holiday greeting to people I've been talking to all year
    and you turn it into a debate about religion and tradition...

    What is wrong with you people?
    The question just came to my mind and I was only interested. Not intending any debate here.
    Hardware: Intel® Core™ i7-3630QM CPU @ 2.40GHz × 8
    Operating system: Fedora 19 (64-Bit) / Linux 3.11.6-200.fc19 / KDE SC 4.11.2
    Compiler: gcc 4.8.2 with Netbeans IDE 7.4

  11. #11
    Registered User
    Join Date
    Nov 2011
    Location
    Douala, Cameroon
    Posts
    187
    any way you forget to know that any learning environment has those who teach and those who learn its as simple as that.

  12. #12
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by MK27 View Post
    Also: it makes a lot of sense to me that Xmas largely derives from, or at least gained popularity because of, ancient "pagan" ceremonies marking the winter solstice. Which I consider solstices important, non-religious events. The longest night of the year and all.
    Talking about Winter solstice, it is amazing..that just about every culture celebrates it, in somewhat similar ways..since ancient times.
    I'm quite tempted to accept Daniken's theory about how this got synchronized.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  13. #13
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Nyah Check View Post
    any way you forget to know that any learning environment has those who teach and those who learn its as simple as that.
    And you're still doing it...

    You are incapable of simply saying "Happy holidays"... aren't you?
    Everything has to be disagreement or discussion.

    Really, think about this... Think about it real ....ing hard...
    What would happen if you just said something nice?
    What would be the worst possible outcome?

    GEES!

  14. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,598
    Enjoy your holidays! (While it lasts, if you have any, heh.)
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Also, a lot of people celebrate Christmas without any connections to religion at all. It is simply a tradition, as in, not a religious tradition.
    Happy holidays to everyone, then!
    MK27 and dennis.cpp like this.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why capital letters in function
    By vrkiller in forum C++ Programming
    Replies: 2
    Last Post: 02-19-2011, 12:21 PM
  2. Capital Letters?
    By MiroMage in forum C Programming
    Replies: 8
    Last Post: 11-05-2008, 03:32 PM
  3. Capital Letters ...
    By twomers in forum C++ Programming
    Replies: 11
    Last Post: 01-11-2006, 02:10 AM
  4. How To Make Capital Letter To Small Capital Letter??
    By jason07 in forum C++ Programming
    Replies: 3
    Last Post: 10-10-2005, 04:37 PM
  5. check for capital letters
    By blackwyvern in forum C++ Programming
    Replies: 3
    Last Post: 01-30-2002, 09:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21