1,177 Posted Topics
Re: I don't think you should try to catch this behavior (non integer entered) with a switch. You should look into the "isdigit" function: [url]http://www.cplusplus.com/reference/clibrary/cctype/isdigit/[/url] Another thing to try is [icode]cout << input; [/icode] to see what input actually is. | |
Re: Did you take a look through this tutorial? [url]http://www.cplusplus.com/doc/tutorial/classes/[/url] They have great explanations and examples. David | |
Re: That error is pretty clear from a c++ perspective, the type of the paramter you are passing is a vector but the function is expecting a matrix. For more specifics you'd have to ask the OpenCV people. | |
When I get an email notification of a second+ reply to a thread, GMail collapses way too much of the email. [url]http://www.rpi.edu/~doriad/daniweb.jpg[/url] The main thing that is missing is the link to the thread! (Of course I find it if I click "show quoted text". Is this a gmail setting? … | |
Re: You are looking for "threads". Boost has a fairly easy to use thread (a simple example: [url]http://programmingexamples.net/index.php?title=CPP/Boost/Threads[/url]) and Qt also has one (QThread). Don't be fooled though, threads get very complex very quickly, so you'll have to do your homework :) | |
Re: I use KCacheGrind to look at the output of valgrind's callgrind option. | |
Re: I would start not by trying to do the assignment, but by trying to break down the assignment into generic programming problems. "How do I get input from the user?" "How do I make an array?", etc. We can help you with these sorts of things (after you Google for … | |
Re: Is the problem with reading them from the file? Or displaying them to the screen? I would separate this problem. 1st program) read the file and inspect its contents in memory 2nd program) hard code values and output them to the screen By doing this you will isolate the problem … | |
Re: This is not keyboard emulation (which would be GENERATING key presses), but rather just catching key presses, right? Apparently this can be done using curses: [url]http://www.codeguru.com/forum/showthread.php?t=435771[/url] | |
Re: I suggest you first write a linked list for ints. This will condense your code into at least a quarter of its current size. Also, remove the file input stuff and hard code some values. Once you have this working, you can "upgrade" your linked list class to support this … | |
Re: Why do you have to name all of the operators? Can't you just push all operators from each string into two stacks and then compare the elements of the stacks? I suggest you hard code two strings, parse them into the two stacks, and then output the contents of the … | |
Re: You look like you're off to a good start. Once you get some more of the details filled in, if you have any specific errors or questions let us know. | |
Re: Looks fine to me. And yes, you would just delete the array at the end of the program. | |
Re: I would ask the OpenCV people if they ever run anything on mobile platforms: [url]http://tech.groups.yahoo.com/group/OpenCV/[/url] | |
Re: What do you mean "the number of sequences"? Please give an example number and explain what you would expect the result to be. Did you give it a try? You'll get much better replies if you ask a specific question about a problem you're having rather than just asking for … | |
Re: You should definitely separate the user input from the computations. An added benefit of doing this is that you can hard code some values for testing purposes. Also, your function should return something and then you should output the answer from main. | |
Re: Where does the problem occur? | |
Re: 'worked' does not appear at all in line 28, so I'm assuming you haven't pasted the code the same as it appears in your file? | |
Re: Please use code tags when you post code. You cannot re-use the word 'struct' here. [code] struct Data A1[100], A2[100], A3[100]; [/code] It needs to be: [code] Data A1[100], A2[100], A3[100]; [/code] Also, please only post relevant code - that is, the shortest compilable code that produces the error you … | |
I want to have a template function like this: [code] template <class T> void CreateBlankPatch(typename T::Pointer patch, unsigned int sideLength) { CreateConstantPatch(patch, typename T::PixelType::Zero(), sideLength); } [/code] It works fine as long as Zero() is defined for the class T. However, with POD types, this is clearly not the case. … | |
Re: Please pose a question clear enough to be explained and demonstrated in a < 30 line, compilable example. The code should then be posted using code tags. | |
Re: This is quite a complicated function. It is almost impossible to follow - you have multiple nested loops, one letter variable names, and NO comments!! Just because it is called "code" doesn't mean it has to look like an encrypted document! Every one of those nested loops could probably be … | |
Re: You can always do a `system()` call to make c++ do it the way you would do it from the command line. In linux, I would use wget: system("wget yourURL"); I'm not sure what you would use in Windows. David | |
Re: Can you please clarify by giving a small example of the graph and resulting adjacency matrix? | |
Re: Please try to "abstract" your question. This has many benefits (more on this here: [url]http://daviddoria.blogspot.com/2010/05/problem-abstraction-helping-others-help.html[/url] ). For example, instead of: [QUOTE] and im stuck at a part where my program crashes after the ships move for a while [/QUOTE] which has little meaning to anyone not in your class, you … | |
Re: So basically you are having a problem with file input? Can you post that code (using code tags)? Maybe make a small, compilable demo (< 30 lines) of what is going wrong? | |
Re: I suggest you work through this excellent tutorial: [url]http://www.cplusplus.com/doc/tutorial/[/url] before attempting that assignment. | |
Re: There is no difference between "the compiled code" and "the executables created". The code compiles INTO the executables! Can you explain how you are running these "different versions"? | |
| |
Re: You call this: [code] string = zipCode; [/code] before you have defined zipcode. Did you mean to say [code] string zipCode; [/code] ? Also, you can access individual characters in a string with the [] operator. That is, you can check if the first digit is a '6' by doing: … | |
Re: You need to abstract the problem wayyy past "Monsters Inc". You should ask the question generally so it helps the most people. Here are some details and specifics: [url]http://daviddoria.blogspot.com/2010/05/problem-abstraction-helping-others-help.html[/url] Maybe something more like "I have two objects and I want to transform them together" or something like that. You should … | |
Re: Haha games are probably not the best place to start. To write a game you have to know some "regular" programming as well as some graphics programming. I would start by going through some OpenGL tutorials. There are some compilable examples here: [url]http://programmingexamples.net/index.php?title=OpenGL[/url] and some great tutorials here: [url]http://nehe.gamedev.net/[/url] | |
I can see visible wearing on my keys in the phrase "Please use code tags when you post code" (just kidding...). Is there a way to try to auto-detect when this happens and remind the user to do so? In c++ it shouldn't be too hard, look for a few … | |
Re: Shouldn't this [code] GarbagePointer<int> myGC=new int; [/code] be more like [code] GarbagePointer<int> myGC=new GarbagePointer<int>; [/code] | |
Re: As far as I know you can only 'switch' on int types. CommandCStrngType is definitely not convertible to an int! You should just replace your switch statement with a big if/else if/else. | |
Re: It doesn't sound like this has anything to do with your game. Maybe you can make a short, compilable example of this lagging effect in a very general context that someone can take a look at. | |
Re: You can use a vector instead of an array [url]http://programmingexamples.net/index.php?title=CPP/STL/Vector[/url] It also has a bunch of cool operations built in (sorting, etc). | |
Re: Is it: A) [code] group individ; [/code] B) [code] group* individ = new group; [/code] or C) [code] Do_Your_Own_Homework(); [/code] | |
Re: Most of the revision control sites now have built in bug trackers. Github.com for example: [url]https://github.com/blog/411-github-issue-tracker[/url] The big projects I work on use Mantis. | |
Re: 1) What is the problem? Does the compiler produce errors? Does it not work as you would expect? What is your input, expected output, and current erroneous output? 2) I always suggest separating the computation from the user interaction. Hard code some values and get the algorithm working before you … | |
I am trying to include a file 'header.php' that is in [url]http://ewh.ieee.org/r1/schenectady/[/url] From a file in [url]http://ewh.ieee.org/r1/schenectady/Events/[/url] if I do: [code] <?php include '../header.php';?> [/code] it works fine, as expected. However, if I do: [code] <?php include 'http://ewh.ieee.org/r1/schenectady/header.php';?> [/code] it does not work (the header is not displayed). Can anyone … ![]() | |
Re: I don't think the conditional on HYS_GLOBAL_VARIABLES is necessary because it is true in exactly the same case that the outer HYS_MAIN_HEADER_H is true. Also, why are you including those windows.h files? | |
Re: That code doesn't run for me. It crashes on line 58 [icode] v[i][j]=x[i]*y[j]; [/icode] which means either x, y, or v isn't big enough. | |
I have a sidebar.php which contains: [code] <a href="page.html"><src="images/MyImage.gif"></a> [/code] If I do: [code] <?php include 'sidebar.php';?> [/code] from a file that is in '/', everything works properly (because it looks in /images for the gif). However, if I do: [code] <?php include '../sidebar.php';?> [/code] from a file in, say, … | |
Re: Is there a reason you're writing your own list class instead of using the one in the STL? [url]http://programmingexamples.net/index.php?title=CPP/STL/List[/url] | |
Re: As I mentioned in your other thread: [QUOTE] I suggest you make a compilable program no longer than 25 lines that demonstrates the issue. You should also put output statements at every place possible inside 'inttohex' so you can see exactly where it is going wrong. You should also do … | |
Re: Are you sure its supposed to be capitalized? The name of the header is 'mysql', so I would try [icode]mysql *conn;[/icode] | |
Re: This is not valid syntax: [code] u_short htons(u_short hostshort); [/code] I think you want simply: [code] u_short htons(hostshort); [/code] | |
Re: What do you mean by "no luck"? Can you show us the error message? My first guess is that I would image Show() takes a string, not a numeric value. |
The End.