1,177 Posted Topics
Re: You should look into fstream to write data to a file, and iostream to read input from the command line. | |
Re: This is probably a better question for this forum: [url]http://www.opengl.org/discussion_boards/[/url] | |
Re: I would suggest making a very small (<20 lines) example of one piece of your program that is not working. In many cases, by breaking it down like this you will solve your problem on your own :) | |
Re: Why do you need global variables to do this? | |
I typically make a Types.h to define all of my types in and then include that in all of my project files. I haven't ever seen this anywhere though, so I assume it is "bad/wrong". The situation is often like this: Consider a class Gardener that needs to know type … | |
Re: You will save yourself countless headaches by not using double arrays, but rather double vectors: [url]http://programmingexamples.net/index.php?title=CPP/2DVector[/url] ![]() | |
Re: This line [icode]if(!(i%j)) break;[/icode] says "if you can divide i by j evenly (with no remainder), i is not prime". It could be more clearly expressed as [icode]if(i%j == 0) break;[/icode] I'll leave the next line for someone else :) | |
I just watched this webcast: [url]http://videos.webpronews.com/2011/05/31/daniweb-speaks-out-on-recovering-from-google-panda/[/url] I'd like to follow up on the idea of no-indexing threads with zero replies. During the webcast it was stated that the idea was to not have people find a thread that has their exact question but no answer. In some cases, they will … | |
Re: The key to recursion is defining a base case. Here the base case should be "making change for a penny?". Take a look at this: [url]http://programmingexamples.net/index.php?title=CPP/recursion[/url] and see if it points you in the right direction. You'll probably need to define an array with the possible values of a coin: … | |
Re: If that is your entire program, you are definitely missing main(). From main, it looks like you should call gdiscreen(). The "identifier not found" would be fixed by adding a declaration before you call the function: [code] int GetEncoderClsid(const WCHAR* format, CLSID* pClsid); [/code] David | |
Re: Is there a problem? If so, please explain it. If not, this should be moved to Code Snippets. | |
Re: When you output a pointer, you will certainly get its address. That's what a pointer is, just an address. When you dereference the pointer and print that, you'd have to have the << operator defined. [code] friend std::ostream& operator<<(std::ostream& output, const Point &P); [/code] Here is a full example: [url]http://programmingexamples.net/index.php?title=CPP/OverloadOperator[/url] | |
n windows I used GDI+ to capture a region of the screen. Is there something similar for linux? I want to do ScreenCapture(Top, Left, Width, Height); and save it to a file (png or something). What's the easiest way to do this? Thanks, Dave | |
Re: Please explain what is going wrong. If possible, try to shorten the code and have it still produce the problem. | |
Hi all, I am trying to write a function to solve an equation for one of its variables. E.g. X + Y + Z = 0 This equation would be represented by its parameters: parameters[0] is X, parameters[1] is Y, parameters[2] is Z. If the user wants to solve for … | |
Re: You should make the title more descriptive - like "Qt linker errors". Also, you will probably have better luck here: [url]http://www.qtforum.org/[/url] | |
Re: Whenever you're having an error you can't track down, the first thing I would suggest is to remove all user input and hardcode values that you know the correct behavior of. You should then try using a debugger to step through the code while watching the variables to see if … | |
Re: This seems like a better question for a Microsoft forum. It is not really c++ related. | |
Re: You could make a character array and then create random numbers: [url]http://programmingexamples.net/index.php?title=CPP/RandomNumbers[/url] as indices to the array and output the character at the random index. This would all be done in a loop. | |
Re: Please use code tags. It doesn't tell you which symbol is multiply defined? | |
Re: Which line is it crashing on? Have you check to make sure all of the pointers are non-null? | |
Re: My only guess would be: [icode]LecERDClick(this)[/icode] but you'd probably be better off asking whoever wrote this. | |
| |
Re: You'll probably have better luck here: [url]http://tech.groups.yahoo.com/group/OpenCV/[/url] (Their data structures are really wacky - good luck :) ) | |
Re: I'd bet you Qt has some widgets that are searchable. I've never used them, but it might be worth looking into. Also, are you sure you need to do this in c++? People tell me that perl is the way to go for string manipulation/searching/etc. | |
Re: Sounds like fun! I'll tell you what, since it's so much fun, I'll let you give it a try first! When you get stuck (show us the code and a specific problem you're having, precisely stated), we'll chime in. | |
Re: I think you will have better luck here: [url]http://www.qtforum.org/[/url] | |
I was under the impression that you could completely gaurd anything you wanted with an [icode]#if 0 [/icode]. Apparently this is not the case? I found some code that has opening /* comments but no matching closing */, and the /* seems to comment out the [icode]#endif[/icode], resulting in everything … | |
Re: I strongly suggest breaking down your problem into tiny pieces. People are much more willing to help you solve generally useful problems rather than your specific problem. For example, if you start a thread asking "How do I erase a line from the terminal?" you will likely get some answers, … | |
Re: You have to make sure that the GL directory (if you use gluh.h) or the directory that contains the GL folder (if you use GL/glut.h) is on your "include path". Depending on your environment (Visual Studio, etc) the method to set the include path varies. As a test, try #include … | |
Re: First, please use real words (anyone vs any1). Second, where did you see this cpuh.h ? We need some context. | |
If I want to generate all combinations of a set of numbers 0-max, I can do so with for loops. The following code will output all two-number pairs: [code] for(unsigned int i = 0; i <= max; i++) { for(unsigned int j = 0; j <= max; j++) { cout … | |
![]() | Re: There is nothing magic about compiling something with a GUI. You simply have to link to the GUI library (in your case Wx) that you want to use. You can see the setup with CMake here: [url]http://programmingexamples.net/index.php?title=CPP/WxWidgets/Basic[/url] |
Re: Why not just make a loop over the index instead of having a separate explicit loop for each index? | |
Re: Please use 'code' tags instead of 'program' tags. Also, please use real words instead of "frndzz, bt, dun knw wats wrng". | |
Re: I suggest making the smallest possible compilable code that demonstrates the problem you are having with a dynamically allocated class. | |
Re: This is a help forum, not a "we do your work for you" forum! | |
| |
Re: Is insertIfNew called in the constructor? I'd suggest you make the shortest possible compilable code that demonstrates the problem. "I am having a problem" should be converted to what the problem is and where/when it occurs. | |
Re: What do you mean by "tests"? Can you show us your current code? Can you tell us exactly what you are starting with and what you are wanting to produce? David | |
![]() | Re: Those are linker errors. You have not shown your compiler commands, but you'll need a `-l something` in there somewhere. I have put several OpenCV examples here: http://programmingexamples.net/index.php?title=OpenCV They all use CMakeLists.txt files to be used with the CMake build system, so unless you switch to CMake (which I highly … |
Re: Generally it's a good idea to abstract the problem into as simple and small piece of source code that you can rather than upload your entire project. This way when an answer is obtained, it will help others in the future as well, rather than just help the king move … | |
I was wondering if I partially specialize a class (which I'm understanding to mean hardcode some of the template parameters?) if I have to implement all functions or if I can just implement some functions. I put together a demo: [url]http://programmingexamples.net/index.php?title=CPP/Templates/PartialClassSpecialization[/url] Where in the main class definition there are two … | |
Re: Please use code tags when posting code. Also, try to remove any code that is not related to the problem. For example here the greeting() function is unnecessary. You will find that the shorter you can make the problem, the more likely people are to look at it :) | |
Re: I think [code] for (; num; num /= base) { [/code] could be written [code] for (; num != 0; num /= base) { [/code] It was using the idea of "anything non zero evaluates to true (or "continue the loop") while when it is zero the loop should stop. … | |
Re: For starters, I would suggest never using spaces in a file name :) If you insist on doing so, I think Windows likes backslashes instead of forward slashes - I don't if c++ cares about this. Also, you may need to "escape" the space with a backslash: read_file("F:/2nd\ year_2/Data structure … | |
Re: You may want to take a pass through something like this: [url]http://www.cplusplus.com/doc/tutorial/[/url] to get an idea of variable types, etc. | |
Re: Welcome to DaniWeb! To help us help you, here are some tips: 1) Use code tags (I see you put brackets around the code, but you need to use [code ]code goes here [/code ] (but without the space) 2) Please tell us what the program is supposed to do. … | |
Re: Are you deleting the memory you are allocating with malloc? Depending on how big these matrices are, maybe you are running out of memory? Do you need to keep each of these 4000 matrices? Or just use it and then discard it? | |
Re: VTK (vtk.org) and ITK (itk.org) also have a lot of tools that could be useful. VTK even has a huge set of examples :) [url]http://www.vtk.org/Wiki/VTK/Examples/Cxx[/url] |
The End.