darrylsh

Members
  • Content count

    65
  • Joined

  • Last visited

Community Reputation

163 Neutral

About darrylsh

  • Rank
    Member
  1. A probably simple yet large C++ problem

    You really should put your includes in your header file if that is what uses them and not rely on putting the standard includes ahead of your header include in the cpp file. If you ever need to use that header again in another project, you will always have to remember to add the includes where if you put them in the header where the dependency is then you won't
  2. Noah's Ark Found?

    Quote:Original post by Strider_Hiryu Not that this whole Noah's ark thing is my forte, but to have a boat that carried two of every base species of animal, not to mention food for 40 days to sustain the diets of each animal. Given the proposed dimensions of the boat, It just doesn't seem... likely. It only rained for 40 days, the ark was adrift like 150 days ( or longer depending on which verses you use)
  3. Normal C++ on VC 2005 EE

    First off it's int main and not void main... although some compilers might (wrongly)allow void I am almost certain VS2005 does not. To your question, VS2005 will compile the simpler "Hello World", You just need to create an empty project or turn off pre-compiled headers setting. By default VS will use precompiled headers which then require the extras you speak of.
  4. Quote:Original post by thannett Your not linking with the correct libraries. EDIT: Try linking with OpenGL32.lib and GLu32.lib Correct, he's not linking with the correct libraries, but it's the windows libraries he's not linking too. You must have skipped that step in the instructions for installing the psdk with vc express. There a configuration file that you need to hand edit.
  5. We are obsolete.

    As far as becoming a standard goes, directx and opengl have become that way because they are royalty free, high quality APIs with a lot of support behind them. When a game engine can make a similar claim, it might just become that defacto engine. Another thing is that game engines can be difficult to understand/use/learn except for the expert programmers out there. The average programmer I think is overwhelmed by the complexity and therefore chooses to write their own to have a full understanding what is going on.
  6. The steam results are gamers, so more than likely they have a decent to above average video card. From what i've seen, outside of the gamer crowd are these inexpensive systems with the on-board video, typical by Intel that can only handle like DirectX 6.
  7. Sudoku Puzzle Contest

    Contest It's basically a contest(c/c++) to generate a completed Sudoku puzzle in the fewest amount of tokens possible... see link for details. Thanks, Darryl
  8. DirectX with Visual Studio 2005

    Win32 project, however, if you didn't know that, you might be getting ahead of yourself diving into Directx
  9. Best compilers around!

    Regarding Intel vs MSVC, if you are interesting in taking advantage of the hyper-threading of some of the newer Pentium chips, you'll have to get the Intel or wait for the VC 2005.
  10. Quote:Original post by Fruny Sheeesh, you've not even tried, have you? Nothing is stopping you from creating a priority queue of pairs with a custom comparison functor. ... There almost always are ways to plug things together. [smile] Well no I didn't try, but as I sort of explained in the first post, I am not so familiar with STL and the Docs are pretty cryptic to me...I mostly have learned STL from looking at examples of their use, so after you suggested priority queues, I went to the docs and ofcourse, was unable to put it together the way you did, but then again if I could had done that, I probably wouldn't had needed to ask in the first place ;-). But your example is very useful and I will tuck it away for future reference, if you had included it originally, I probably wouldn't had written of Priority queues so quick :-) I did however implement what I wanted using the multimap because I am familiar with the similar map class...but let me ask this real quick. Are [] defined for multimap? For map I can insert using mapobject[key] = value, but this didn't work for multimap, so I used insert, but I would had preferred the other way. Don't see why it wouldn't be defined, maybe has to do with there not being unique keys...hmmm Anyway, thanks Darryl
  11. Quote:Original post by Fruny Use a std::priority_queue Don't see how priority_queue would work, it doesn't take a map container, only something like a vector or a deque(any container that supports front(), push_back(), pop_back()), but as I need to store the pair of values, those won't work. Though I guess I could make a vector of maps first, but it would be easier to just sort the map into a vector directly. I think dalleboy's suggestion of multimap will work directly as I can use the distance as a non-unique key that will automatically be sorted as I want and provide back the location. Thanks, Darryl
  12. Quote:Original post by dalleboy But I think you're biting your self in the foot. You could have a std::multi_map<int, std::string> that maps the age to the name. What are you trying to do? I am open to suggestions...the above was just an example, below is closer to the actual program, though simplified a bit. basically I have a program that maps a custom enum "location" type variable and a int enum location{a, b, c, d, e . . . z}; location DesiredLocation = c std::map<location,int> DistanceToDisredLocation for( int i = 0;i <= z; i++) { DistanceToDesiredLocation[static_cast<Location>(i)] = Distance(i,DesiredLocation); } // Sort Map here so now I want sort the map by distance from the closest to desired, to the farthest. Darryl
  13. Hi all, Although I am pretty familiar with c++, I mostly avoided using STL, but as of late I have found it to be very useful and invaluable, however, I find the documentation for it to be quite cryptic. Anyways, I want to create a standard map using a alternative sorting function. I understand that a map is by default sorted by the key value, However, I'd like to sort it by it's data value, for example: Suppose I have a map of names (key) and an int (data) Tom 10 Dick 20 Harry 30 Darryl 40 by default the map will be sorted alphabetically by name (key) I would like it to be sorted as listed above, by data value. I have looked at using the value_compare member, but am lost as to what I need to do and have not found any simple/clear examples on the net. Any assitance would be appreciated. Thanks, Darryl
  14. Quote:Original post by Coder Quote:Original post by johnnyBravo visual c++ 6 has a few annoying things, one of them is you cant do this: for(int i=0;i<4;i++) { } for(int i=0;i<4;i++) { } it will return a redefinition error. As a workaround, you can do this: #define for if(0); else for which fixes the issue. a better work around is to enclose the whole loop in braces, making the loop a local scope as it should be. {for(int i=0;i<4;i++) { ... }} {for(int i=0;i<4;i++) { ... }}
  15. Quote:Original post by Jubulani Try this, it might work: ... snipped I think this is what you want. Let me know if it isn't. hmmm this name "Jubulani" looks familiar, you're not to be looking at my Clue code :P I got it working though, thanks, Darryl