Thread: pointers again

  1. #16
    Registered User
    Join Date
    Apr 2006
    Quote Originally Posted by lilhawk2892
    i swear to god if one more person does the "like"thing,i only did it once or twice

    and how would i limit down my code then
    Loops and functions.

    For example, write a print stat function for whenever you need to print the stats.

    Or for a more OO aproach, make the stats a class, and have a print meathod.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  2. #17
    Registered User
    Join Date
    May 2006
    Or overload the << operator.
    class myClass {
            std::ostream& operator << (std::ostream& os, myClass& mc) {
                os << a << ' ' << b << std::endl;
                return os;
            int a, b;
    Something along these lines. I haven't done this in a while.

  3. #18
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Chch, NZ
    Quote Originally Posted by citizen
    > and how would i limit down my code then
    You need to learn the 80/20 rule. One application is, "If your program does anything useful 80 lines of code accounts for 20% of what it does." You can not apply this literally, but as we've been saying you can not expect every application or game to work in <100 lines of code. In fact, most don't.
    eh? WTF are you talking about? the 80/20 rule states that 80% of the execution time will be spent in 20% of the code (although in reality it's often closer to 90/10).
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  4. #19
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    The 80/20 rule has many applications, but I bended the principle to say what I wanted to say. I explained what I was talking about. And 90/10 is improper.

    edit: I dp not intentionally give wrong advice. I'm wrong a lot. However, I simply have to explain things in a different way because thinking is hard.
    Last edited by whiteflags; 07-05-2006 at 10:52 PM.

  5. #20
    Registered User
    Join Date
    Sep 2005
    errr its ok i didnt understand it anyways...

    thank you i didnt even think about that even though ive been using functions for everything else...ill make that

    oh and im already up to 124 lines in about 1 minute of the game running lol.i expect easily a couple thousand XD

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 05:59 AM
  2. function pointers
    By benhaldor in forum C Programming
    Replies: 4
    Last Post: 08-19-2007, 10:56 AM
  3. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 01:18 PM