2,898 Posted Topics
Re: The purpose of a game engine is to facilitate development of one game, then another, then another, etc. (typically a real game is made of 80-90% game-engine code and the rest is the actual game logic, then you have the artistic part, all the 3D models and animations and everything). … | |
Re: You can do a C-style cast (although the compiler will complain) or a reinterpret_cast of the pointer to one with no const restriction. Or as Agni said, just make it mutable. One thing that ticks me though... you say "I have a const-correct method".. well putting "const" at the end … | |
Re: I agree with Stu, you need to post some sign of an effort. Just a start-up idea, use a function (method) to compute the square-of-the-distance between two points (as in a method of class "point"), and you can pretty much use it for all the other methods. @StuXYZ: you should … | |
Re: you're not outputting values f[0] and f[1] before entering the loop. | |
Re: Well \ is a special character. C++ still caries the remnants of C formatted strings, for good reason. So "\\" actually means the single character "\" and "\" or '' is an error. This is because you use \ to enter special characters like '\t' for tab, '\n' for newline, … | |
Re: @coolzinthis this is pretty straight-forward: [CODE] #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct Person { string first; int votes; }; int computeTotalVotes(Person* candidates, int count) { if(candidates == NULL) return 0; int sum = 0; for(int i = 0; i < count; i++) sum += … | |
Re: Well, I have more than 12 years of experience in OOP programming and I started as a teen with 3D game programming (now doing more multi-body dynamics simulation, robotics control software and artificial intelligence). I jumped right into OpenGL from the start and painfully rammed through it all. I recommend … | |
Re: @Agin: I think using generic algorithms goes against the purpose of the exercise.. First, a simple trick is to use a magic number like 0 or MAX_INTEGER or something to mark the already matched values as invalid, then check that a number is valid before looping for matches. Second, the … | |
Re: I don't understand how "gradez = grade[] + 1;" is supposed to "try to match what letter grade the user typed". This makes absolutely no sense to me! well, doing "gradez++;" will effectively turn an 'A' into a 'B' and so on. I guess that line was mistyped on this … | |
Re: cin is a buffer, it needs to flush, just like cout. There is no guarantee that cin will flush every time you press a key but it is guaranteed that it will flush when you hit enter (just like cout is guaranteed to flush when you write std::endl or "\n"). … | |
Re: Wow... your prof. seems to be a d'bag. Not to mention that this is probably the worst possible way to implement a sparse matrix class. And it doesn't seem like your prof has much of an idea about C++ programming. Anyways, the explanation is very vague, but from what I … | |
Re: the copy() function will try and increment the iterator on std::cin until it finds this null istream_iterator (which I doubt is a correct use, but I'm not so familiar with this class). The problem is that std::cin is special in the sense that every time to increment the iterator it … | |
Re: First of all, you need some kind of GUI for this, cin / cout won't be good enough for sure (or a least a lot of trouble). So figure out what you want to use first (Qt, MFC, SDL, whatever..), then you can start to solve that problem. Second, I'm … | |
Re: First of all, inventory should be initialized to contain at least one element for case A (otherwise inventory.begin() is pointing nowhere) and at least two elements for case B,C,D. Then, you have to understand that an iterator is essentially a pointer (not exactly, but it behaves like one), so setting … | |
Re: I think C++ can be hard at first.. a good way to ease into, if you already have some experience with C or other simple procedural languages, is to just keep programming in C but compile in C++ and slowly change you habits from printf to std::cout, from malloc to … | |
Re: You should find out where this error occurs: Is it before writing the first chunk? -something wrong with init. Is it right when you switch to second chunk? -something wrong with the switch. Is there anything special about the point at which the error occurs (middle of a chunk or … | |
Re: This site was not mentioned yet, but I like it a lot for all the small details you might overlook while coding but that often are hugely important: [URL="http://www.parashift.com/c++-faq-lite/"]http://www.parashift.com/c++-faq-lite/[/URL] It nicely written and cover a plethora of issues from very simple to very complex. | |
Re: Well from what I know if you use shared libs (as it is stated there) than don't expect your library to be completely statically linked.. it is not dependent on how you compile or link your code but how the libraries you use are made. As simple as that. A … |