You're converting numbers to strings and concatenating two of them together, then comparing strings; that's a pretty strange way to test whether some numbers are the same. Since you're summing up...
Type: Posts; User: dwks
You're converting numbers to strings and concatenating two of them together, then comparing strings; that's a pretty strange way to test whether some numbers are the same. Since you're summing up...
You may find it useful to store the numbers you've read so far in an array, then search the array to see if the user has entered any duplicates. The getch() and clrscr() functions are non-standard...
Great links so far! What I'm going to say is all Linux specific, but here we go. Object files (.o) created by the compiler, executable files created by the linker, and shared libraries (.so) are all...
freddie, any exception can be replaced with a bool wasThereAnError member of a class and then checked later. I've done this refactoring myself in some cases when C++ exceptions are not supported by...
When you do a dynamic memory allocation,
map[1][0][0] = (int *)malloc(sizeof(int));
if you want to then use that memory location, you must dereference the pointer. What you're doing instead...
You can use multiple threads each with an io_service, but asio multiplexes all asynchronous requests that you make and waits for any of them to complete. It basically adds all the file descriptors to...
The asynchronous functions wait until the operation completes (data ready to read, or socket reports write has been processed) before calling the callback function. That's the point of asynchronous...
You could register a function on a timer to handle the case where the client doesn't respond: c++ - boost asio deadline_timer - Stack Overflow
Note that if the underlying TCP connection is...
Typically each function would execute async_read or async_write with the next function to be called registered as the callback. They daisy-chain together. In case of errors the error handling...
The idea is that a structure definition can either a) declare a new type of structure, or b) declare instance variables of a structure, or c) both. If you only want to use the structure once, you...
You're reusing the loop variable i here:
for (i = 0; i < s.numWidths; i += 1){
maxWidth += s.fieldWidths[i];
p.n = ceil(maxWidth / 32.0);
p.fieldValues =...
In most of your functions, you take a "head" pointer as a parameter to the function; then you allocate a node called temp, and set its next to NULL, and proceed to iterate through temp. Since you...
Some other comments about your code in general:
init() is a fairly common name as well, you may want to change that just to be safe. ;)
Standard name for main()'s parameters are argc, and argv....
I used to be an expert in SDL 1.2 but I haven't touched SDL 2 yet, so I thought I'd take a look at your code. It was very puzzling, I have to say. You're getting SIGBUS or SIGSEGV whenever SDL_Quit()...
Within your outer "Print pyramid" loop, you are printing the data for one line at a time (and ending with a "\n"). So your "Print hash" loop has to print all the #'s that are going to appear on one...
Look up fscanf(), or use fgets() in combination with sscanf().
The example doesn't actually create a linked list at all. It makes a single EnemySpaceShip, then calls updateShip on that single ship. The structure does have a next pointer which is set to NULL, but...
You mean, how do you include the code into your project? I guess you would figure out which development environment you're using (Microsoft Visual Studio?) and search for how to add files to the...
Wrote this at the same time as killme, we're probably saying the same things...
Enums can be used for returning information from a function, passing information into a function, or storing data...
You're also calling SDL_Flip twice (once in main and once at the end of make_move); I'm not sure what effect this will have. SDL_Flip is meant for when you have a hardware surface (SDL_HWSURFACE),...
Actually, in C if you declare a function prototype's argument list as (), this means "I don't know and I don't care what the argument list is", which is different from saying (void), which means...
Okay I haven't looked at what you're drawing too closely, but keep in mind that the (X,Y) coordinates reported by a glut mouse click callback are in screen coordinates, not in world (OpenGL)...
Good point. Error messages are coming from "/usr/include/c++/4.6/" in the original post. Didn't notice. :)
Basically enums are to handle this, which happens every now and then: You start with a simple variable that can be on or off, so you use a bool. Then you realize it really has a third state, so you...
Regarding flags: for starters, try -std=c++11. That should enable lambdas.