2,898 Posted Topics

Member Avatar for ichigo_cool

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). …

Member Avatar for mike_2000_17
0
121
Member Avatar for mrnutty

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 …

Member Avatar for Fbody
0
94
Member Avatar for Anocondo

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 …

Member Avatar for mike_2000_17
0
264
Member Avatar for ota1it1iuss
Member Avatar for shabnamapi
0
422
Member Avatar for AamirH

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, …

Member Avatar for mike_2000_17
0
106
Member Avatar for hking

@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 += …

Member Avatar for mike_2000_17
0
245
Member Avatar for ichigo_cool

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 …

Member Avatar for mike_2000_17
0
612
Member Avatar for Anyzen

@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 …

Member Avatar for Anyzen
0
162
Member Avatar for katokato

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 …

Member Avatar for katokato
0
100
Member Avatar for ChaseRLewis

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"). …

Member Avatar for mike_2000_17
0
85
Member Avatar for aranjan

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 …

Member Avatar for mike_2000_17
0
154
Member Avatar for Agni

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 …

Member Avatar for Agni
0
199
Member Avatar for localp

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 …

Member Avatar for mike_2000_17
0
353
Member Avatar for crapgarden

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 …

Member Avatar for mike_2000_17
1
144
Member Avatar for yap.nice

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 …

Member Avatar for akilank
0
156
Member Avatar for alokjadhav

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 …

Member Avatar for mike_2000_17
0
2K
Member Avatar for Lusiphur

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.

Member Avatar for mike_2000_17
0
369
Member Avatar for dansnyderECE

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 …

Member Avatar for mike_2000_17
0
353