Thread: Christmas with a capital C...

  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 11:24 PM.

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    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
    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...

  4. #4
    spaghetticode
    Guest
    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?

  5. #5
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197

    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 09: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
    Buea, Cameroon
    Posts
    197

    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
    spaghetticode
    Guest
    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.

  11. #11
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197
    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
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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.

  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
    28,413
    Enjoy your holidays! (While it lasts, if you have any, heh.)
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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!
    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.

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, 01:21 PM
  2. Capital Letters?
    By MiroMage in forum C Programming
    Replies: 8
    Last Post: 11-05-2008, 04:32 PM
  3. Capital Letters ...
    By twomers in forum C++ Programming
    Replies: 11
    Last Post: 01-11-2006, 03: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, 10:32 PM