The Programming Game

Discussion in 'Mac Programming' started by slooksterPSV, Jan 10, 2006.

  1. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Messages:
    2,864
    Location:
    Nowheresville
    #1
    I figure we don't have very many users on this forum who post about programming. So I'm going to get you guys more involved. Here are the rules and how you play this game:
    Basically you go back and forth adding a new piece of code to the previous persons source code. We may be able to develop something from this. We'll start off with basic C++ then I'll ask you guys if you want to shift to SDL, Allegro, etc. Any one of those. Now here are the rules:
    If the previous persons source code contains an error or parse error, politely fix it and state what has been changed.
    When you add a new change to the source code, please add at the bottom of the source code (out of the code box) what you added or changed. This helps us to know what to do next.
    I'll start with a basic C++ program note how i use the code box:
    Code:
    #include <iostream.h>
    
    using namespace std;
    
    int main()
    {
     cout << "You guys decide what to do next.\n";
     return 0;
    }
    
    1 - Created basic source code
     
  2. Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Messages:
    32,669
    Location:
    Los Angeles
    #2
    We generally don't allow game threads of the "do something and pass it on" variety, but if you direct this toward accomplishing something useful, I'm sure that fits a loophole somewhere in the 65,536-page forum regulation manual.

    Of course, being a programmer myself, I'm biased in favor of programming themes.
     
  3. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Messages:
    4,861
    Location:
    Western US
    #3
    Sounded interesting until you said C++. :rolleyes:
     
  4. macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    Messages:
    2,862
    #4
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
     cout << "You guys decide what to do next." << endl;
     return 0;
    }
    
    Well, if you really want to strictly C++...
     
  5. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Messages:
    2,392
    Location:
    Hitchin, Herts, UK
    #5
    Ditto....life's too short to mess with C++;)
     
  6. macrumors member

    SamMiller0

    Joined:
    Aug 17, 2004
    Messages:
    64
    Location:
    San Jose, CA
    #6
    I'll fix your code:
    Code:
    #include <iostream>
    
    int main() {
       using std::cout;
       using std::endl;
    
       cout << "You guys decide what to do next." << endl;
    
       return 0;
    }
    
    1. The header is just iostream, iostream.h is deprecated
    2. "using namespace std" pollutes your namespace, only include what you need
     
  7. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Messages:
    2,579
    Location:
    Portland, OR
    #7
    More fixed version:

    Code:
    "You guys decide what to do next." print
    
    Hooray for io
     

Share This Page