2,898 Posted Topics
Re: You need to use your setX and setY functions to set the new positions, as so: if (inputEvent.Event.KeyEvent.wVirtualKeyCode == VK_DOWN) { if (maze.CanPlayerEnterSpace(person.GetX(), person.GetY() + 1)) person.SetY(person.GetY() + 1); } if (inputEvent.Event.KeyEvent.wVirtualKeyCode == VK_UP) { if (maze.CanPlayerEnterSpace(person.GetX(), person.GetY() - 1)) person.SetY(person.GetY() - 1); } if (inputEvent.Event.KeyEvent.wVirtualKeyCode == VK_LEFT) { if … | |
Re: I have the same problem as Rev. Jim, my names are Sven Mikael. Mikael is the given name I go by, and Sven is my forename, like a middle name (not used) but that goes before my given name, which is usual in Sweden, but not in Canada, where I … | |
Re: First of all, only non-static member functions can be declared as `const`. The const-ness applies to the object on which the member function is called, that is, the object and thus all the data members it contains. Here is an example: class Foo { public: int bar; void member_func() const; … | |
Re: There are a few ways to solve this problem reasonably quick. They generally depend on how much memory your are willing to spend (i.e., the classic computer science lesson: memory-complexity can often offset time-complexity). The "slow" method, as you described, is to go through all faces and then for each … | |
Re: > How Can I Restricted The Movement Of The Cursor And Determined At Which Point/Pixel User Hit Any Key..!! As you record the key-strokes to move the cursor, first check that the movement is allowed (remain within the ranges of x and y values), and, of course, keep track of … | |
Re: Categorizing C++ as an OOP language is very reductionary. C++ is a multi-paradigm language. C++ was originally motivated by the OOP "revolution", and that played a major part in its original popularity. In modern times though (21st century), the popularity of C++ is mostly driven by what Alexandrescu calls "zero-overhead … | |
Re: There are a number of problems with your code. First, if you are going to define the multiplication operator as a member function of the class template, you need to make it a `const` function: // the prototype in the class template declaration: double operator*(const TinyVector<T_numtype, N_length> &) const; //<-- … | |
Re: > :'( but how will i live without him ? he is my heart ! to whom can i tell my feelings ? my parents are also so impatient. his ambitions, care, love , he himself i gonna miss. I'm sad to hear that. I think you ought to tell … | |
Re: One fun moment was during my senior year advanced math classes. When we were doing exercises, which is to say, when the rest of the people were doing exercises while I was hacking together an RPG game in assembly language for my TI-83 calculator. As people started having trouble and … | |
Re: Wow.. this is hard to pin down, I've been mostly programming as a hobby and now using my skills as a tool for doing robotics research. I mean, it's always been all about challenging myself with impossible tasks, now my job is to solve impossible problems. So, I have no … | |
Re: (Disclaimer: do not try this one if you don't like to get slapped in the face) "Do you work for a jeans factory? [Why?] Because you're working your way up a ply in my pants." | |
Re: > I would like to find out why is it not necessary for a method to declare an exception when coding in C++? Actually, now with C++11 (latest standard), it is more than just "not necessary", it's deprecated (compilers must still accept the code, but it's highly discouraged to use … | |
Re: If wealth is supposed to trickle down, 99% percent of the people must be standing under a giant **waterproof** cover. **Plethora** | |
Re: This is very nice! It's a neat little piece of designed code to solve a somewhat simple problem but in a fairly generic way. That's cool, it's the kind of code I like to see. As usual, I could point out a few things to improve. At least, there is … | |
Re: What I hate are all those French words or expressions that English-speakers use and speak with a stupidly exagerated and totally wrong pronounciation. Like "rendezvous" or "laissez-faire", even the online dictionaries have a ridiculous pronounciation, listen [here](http://www.merriam-webster.com/dictionary/rendezvous) or [here](http://www.merriam-webster.com/dictionary/laissez-faire). > Why don't people just call it the stomach or abdomen, … | |
Re: The O() means "of the order of". Generally, a function is of the order of its biggest term, i.e., the term that, as n becomes very big, dominates all the others, in other words, the only term that really matters for large values of n. So, if `f1(n) = A*n … | |
Re: > Engineering is a very down and dirty profession, the theory of how an internalcombustion engine works, and dismantling and re-assembling a nice clean college workshop engine is good practice, but cannot compare with a ten year old, poorly maintained breakdown in the street. Kinda off-topic, but this got me … | |
Re: > AFAIK "rank" cannot be bought. It must be earned. I wish that could apply to politics too. | |
Re: I think the most common solution is to use an on-the-fly encryption of the backup file-system. Tools like `dm-crypt` (part of the Linux kernel since quite a while) and `true-crypt` allow you to mount an encrypted file-system, just like you mount a HDD partition but with encrypted key protection. The … | |
Re: > I have compiled and linked my code written in C and C++ and calling certain Windows APIs to a Win32 .dll using MinGW in Code::Blocks runnings on Windows XP. My code has also been compiled to and linked to create a Win32 .exe, which works successfully whilst communicating serially … | |
![]() | Re: When I grew up, in the school yard, we used to play soccer only during the winter. The summer was for basketball, kickball, dodgeball, and street hockey, and the winter was for hockey, soccer and football. Playing soccer in winter time (and outside) is pretty nice actually, I don't know … |
Re: I second deceptikon on that, grab some screen-shots and some UML graphs, print them out, and pop them into a nice-looking sleeve that you can carry to the interview. Hand them to the interviewers at the start of the interview as a "here are some examples of my past projects" … | |
Re: I don't mind that there are lots of "inferior" programmers, in the sense that their knowledge is limited to being able to push the right buttons here and there to get the job done without much understanding of either the technical details or the theoretical aspects of things. I don't … | |
Re: Consistent indentation is really important. I tend to prefer 2 spaces, I don't mind 4 spaces, more is too much IMO. Too much indentation breaks readability of the flow of the code. I tend to use K&R style for braces. I like line lengths to be limited to about 80 … | |
Re: The language standard and the standard library is developed as a negociation between implementors (who need to comply to it) and users (who want features from it). If the amount of users that request a particular feature very strong and all implementors have little or no problem providing it (they … | |
Re: > you guys must learn java programing language because i think aproximate one billion devices are running java... Since most JVMs and most components of the Java's standard library implementations are actually programmed in C / C++, and most OSes are programmed in C / C++ / ASM, the number … | |
Re: I'm a bit younger than you guys... The first (real) computer we had was a Pentium MMX 200 MHz with I believe a blazing-fast 8Mb 3D accelerator card! So, my first experiences were more along the lines of playing one-on-one death-matches of Duke Nukem 3D over the dial-up modem (i.e., … | |
Re: I doubt that Vernon is still developing this game, four years later. But the scrabble dictionary is a good suggestion that others might benefit from. For that reason, I won't vote down your post, but be careful in the future not to resurrect threads from years past. | |
Re: Are you referring to [Job Scheduling](http://en.wikipedia.org/wiki/Job_scheduler) or [CPU Scheduling](http://en.wikipedia.org/wiki/Scheduling_(computing))? For the former, there isn't much to say, it's what the `cron` tool does, and it isn't particularly challenging or involving any special algorithm or anything. For the latter, however, what you'd want to look at is the [Completely-Fair Scheduler](http://en.wikipedia.org/wiki/Completely_Fair_Scheduler) and … | |
Re: An IDE has a number of practical advantages. And they also depend largely on what kind of projects your working on. When you're just "writing code": An IDE helps you with: - reading the code more easily by highlighting the syntax (language keywords, comment blocks, etc.). - keeping the code … | |
Re: Standard file-streams are buffered for efficiency. They read data in advance from the file and temporarily store it in a buffer which is emptied as you extract data from it. So, just use the [`std::ifstream`](http://www.cplusplus.com/reference/fstream/ifstream/), which has an underlying [`std::filebuf`](http://www.cplusplus.com/reference/fstream/filebuf/) accessible through [rdbuf()](http://www.cplusplus.com/reference/fstream/ifstream/rdbuf/). Normally, the buffering is set to be … | |
Re: The trick is just to get a window handle for whatever surface you want to draw on, that is, a valid `HWND` handle that points to where you want to draw. This can be done [easily in Qt](http://jholewinski.org/blog/direct3d-11-with-qt-4/). I assume most other GUI libraries would provide a similar thing. It … | |
Re: I'm not sure, but I'm inclined to think that the indices `i` and `j` should be declared within the for-loop statement. Otherwise, each parallel thread will be using the same variable, which is not going to go well. I would try this: #pragma omp parallel { #pragma omp parallel for … | |
Re: I would say this isn't something that you would do in C++. There are many system administration tools that would help you implement this as a script that is scheduled to run periodically and upon connection of any new "directorate". For example, [the `rsync` utility](http://en.wikipedia.org/wiki/Rsync) would be perfect for the … | |
Re: This certainly exists, the main one that I know of is [OpenMP](http://en.wikipedia.org/wiki/OpenMP). Pretty much [all modern compilers](http://openmp.org/wp/openmp-compilers/) support openmp. It is really easy to use, you just put some `#pragma` statements at the appropriate places, and you configure the number of threads to use (in relation to your number of … | |
Re: Well, facebook is a social network, which has the word network in it, which usually implies a graph structure. And, coincidently enough, facebook uses a graph structure at its core, how surprising... I didn't need to look far to find that out, look at the [URL="http://en.wikipedia.org/wiki/Facebook_Platform"]wiki[/URL] or the [URL="http://developers.facebook.com/docs/coreconcepts/"]developers' page[/URL]. | |
Re: > I disconnected the CMOS battery for quite a while, twice, and the problem won't go away. You should try resetting the "Clear CMOS" jumper on your motherboard, it should trigger a flashing of the factory-original BIOS. That's usually better than unplugging the battery. And if that doesn't solve your … | |
Re: This is a good question. Iterators are awesome but with the implementation of a custom iterator often comes a number of non-trivial issues, especially when you're pushing the envelop. My first recommendation would be to get well acquainted with the different [iterator concepts](http://www.cplusplus.com/reference/iterator/), if you haven't done so already. They … | |
Re: First, a bit of vocabulary. Given a class, an object of that class will contain data members and base-class objects (the instance of its base-classes), these two things are referred to as *sub-objects*. So, the fundamental thing to understand here is that, from a memory perspective, an object and the … | |
Re: I guess the endorsement system can't keep up with the rate at which your "friends" in California register phony accounts and endorse you (i.e., most of your endorsements are from people from California, who registered in the last month, and barely posted anything themselves). You're not exactly coming to this … | |
Re: I would just chip in another vote for Qt. I've had nothing but pleasant experiences working with this library and the tools (drag-drop designer, IDE, qmake and cmake add-on), it's been smooth sailing all the way and the feature-set is very complete, stable and looks good and the same everywhere … | |
Re: The CSV format just means Comma-Separated Values. A typical CSV file would look like this: x, x2, x3 1.0, 1.0, 1.0, 2.0, 4.0, 8.0, 3.0, 9.0, 27.0 4.0, 16.0, 64.0 It's that simple. Just the values, separated with commas. Excel can also import any other similar thing, like values separated … | |
Re: I guess it would make more sense to have the highlighting occur on the "Watched Articles" at the top of the page. I like the idea. | |
Re: Writing a GUI application in C++ must involve one of many GUI libraries out there. As Tinnin mentioned, some possibilities are [SFML](http://www.sfml-dev.org/) or [SDL](http://www.libsdl.org/), and in that same vein there is the Win32 API. All these options are very low-level. They can be useful for making a computer game where … | |
Re: For me, these characters seem to appear when I do ALT + SPACE. I sometimes get those because I use a french-canadian keyboard and the `{}` and `[]` brackets (and a few others) require using the ALT key and they are often followed or preceded with a space, and so, … | |
Re: This is not a bug, it is the expected behaviour. There is a rule in C++ that overloading of member functions is limited to a single class scope. Basically, calling `SomeFunction` on a `Derived` object causes the compiler to look for overloads within the `Derived` class only. If I compile … | |
Re: The actual problem is not the compiler, but the system libraries you need to link to. This is why you get all these linker errors. So, what is needed is an installation of GCC with the two sets of libraries, i.e., for 32bit and 64bit systems. Try the [TDM-GCC releases](http://tdm-gcc.tdragon.net/), … | |
Re: > I already created a version that just stored numbers as "before decimal point [unsigned array]" and "after decimal point [unsigned array]". The decimal point? That's untenable. Are you saying that in order to store the number `1e30` or `1e-30` you need to store a long array of zeros followed … |
The End.