Thread: Make a mess

  1. #16
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Well if you want to go for it citizen. So far the last valid submission was my original post
    Quote Originally Posted by rules
    1) Each new revision must compile with g++, but may have bugs in it (deliberate or not).

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Hmmm.
    Code:
    class BRAIN
    {
    public:
    	BRAIN(): bHasBrain(false) { }
    	bool bHasBrain;
    };
    
    struct DATE
    {
    	WORD year;
    	WORD month;
    	WORD day;
    	WORD hour;
    	WORD minute;
    	WORD second;
    	WORD millisecond;
    };
    
    enum gender
    {
    	female,
    	male
    };
    
    struct HUMAN
    {
    	// version 3
    	// family
    	HUMAN* mother;
    	HUMAN* father;
    	std::vector<HUMAN*> children;
    	DWORD dwChildren;
    	// specifiers
    	gender sex;
    	std::string name;
    	double x, y, z;
    	DATE birth;
    	// more
    	BRAIN mem;
    };
    Let's stop making life so hard on us... When we have C++, let's use it!
    And I still prefer tabs. You stole my quote, and now you try to steal it again?
    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.

  3. #18
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Elysia: could you please put that in a file w/ relevant includes and stuff in a form that will compile and maybe do something? That would give the next person something to work with

  4. #19
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    >> And here I was just going to do a stupid little die roll, and make "Bob" walk somewhere.

    Ah, great idea!

    Code:
    BOOL HUMAN::Rotate(double rads)
    {
       rot = rads;
       return TRUE;
    }
    
    BOOL HUMAN::Walk(double distance)
    {
       x += cos(rot) * distance;
       y += sin(rot) * distance;
       z = GetHeightMap(NULL, x, y);
       return TRUE;
    }

  5. #20
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    That's a horrible class. Each instance of HUMAN has a children vector, even if a particular human is only part of a family. Some humans don't have children so I'm not sure if that is a part of being human. Not to mention that we're using WORDS and DWORDS, which isn't very cross-platform, but mike wants it to work on g++.

    Hmmm, with these problems, I think I liked Bob more.

    Going somewhere with the class, Elysia?

    Yarin: thanks for that.
    Last edited by whiteflags; 03-24-2008 at 02:32 PM.

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Putting it into something compilable now.
    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.

  7. #22
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Alright, here's the source, tested and everything.
    Now feel free to continue building on it.
    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.

  8. #23
    Banned
    Join Date
    Nov 2007
    Posts
    678
    how about making them reproduce now! without any help from programmers!

  9. #24
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    If you want it, go ahead, code it
    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.

  10. #25
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by Elysia View Post
    If you want it, go ahead, code it
    Need a method man.sexytime(). Problem is, they won't be able to reproduce if they're both men :\ -- although they can still have 'sexytime'.

  11. #26
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by Elysia View Post
    Alright, here's the source, tested and everything.
    My build has a few issues with that.
    start.cpp:1:20: stdafx.h: No such file or directory
    start.cpp:13: error: use of enum `gender' without previous declaration
    start.cpp:17: error: `gender' was not declared in this scope
    start.cpp:18: error: `gender' was not declared in this scope
    start.cpp:19: error: `gender' was not declared in this scope
    start.cpp: In function `std::string GetChildType(gender)':
    start.cpp:89: error: `std::string GetChildType(gender)' redeclared as different kind of symbol
    start.cpp:17: error: previous declaration of `std::string GetChildType'
    start.cpp:17: error: previous non-function declaration `std::string GetChildType'
    start.cpp:89: error: conflicts with function declaration `std::string GetChildType(gender)'
    start.cpp: In function `std::string GetHisHer(gender)':
    start.cpp:100: error: `std::string GetHisHer(gender)' redeclared as different kind of symbol
    start.cpp:18: error: previous declaration of `std::string GetHisHer'
    start.cpp:18: error: previous non-function declaration `std::string GetHisHer'
    start.cpp:100: error: conflicts with function declaration `std::string GetHisHer(gender)'
    start.cpp: In function `std::string GetHeShe(gender)':
    start.cpp:111: error: `std::string GetHeShe(gender)' redeclared as different kind of symbol
    start.cpp:19: error: previous declaration of `std::string GetHeShe'
    start.cpp:19: error: previous non-function declaration `std::string GetHeShe'
    start.cpp:111: error: conflicts with function declaration `std::string GetHeShe(gender)'
    start.cpp: In function `void DisplayChildren(const HUMAN&)':
    start.cpp:148: error: no match for call to `(std::string) (gender&)'
    start.cpp:148: error: no match for call to `(std::string) (gender&)'
    *** Errors occurred during this build ***
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  12. #27
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    How about this then?
    Disabled precompiled headers.
    Moved declarations and definitions to top, above the prototypes.
    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.

  13. #28
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    That'll play. Danke.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a Packet sniffer/filter?
    By shown in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2009, 09:51 PM
  2. "Cannot make pipe"
    By crepincdotcom in forum C Programming
    Replies: 5
    Last Post: 08-16-2004, 12:43 PM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM