1,177 Posted Topics
This was just a goof on my part, but it was quite annoying and maybe it could be handled a bit better. I was on a different machine than normal, so I was not logged into daniweb but I didn't realize it. I found an interesting post and spent quite … | |
Re: I think your question would get better responses here: [url]http://forums.libsdl.org/viewforum.php?f=1[/url] | |
Re: 1) Please use code tags. 2) Use <iostream> instead of <iostream.h> (and similar for the other headers) 3) Use more descriptive variable names. What are x? y? i? 4) You'll have to give us a better idea of the problem. What is the current output? What is the expected output? | |
Is there a way to make a string variable in "normal" html (that is, not inside of a <script> tag)? I want to do something like [CODE] Number='005' <a href="http://domain.com/"+Number+".html">my link</a>[/CODE] Is this possible? Thanks, David | |
Re: You can fix the warning: [code] The source directory C:/ne7ssh-1.3.2/src does not contain a CMakeLists.txt file. [/code] by commenting: [code] #add_subdirectory ( src ) [/code] Other than that, cmake ran fine for me (Fedora 13). I couldn't build it because I didn't install Botan, but the Makefile was generated successfully. | |
Re: Welcome to DaniWeb! To allow us to help most effectively, please use code tags when you post code. Also, you should always comment code as much as you can. When you post code that isn't working, you should also show the incorrect output (or any errors that occur). I also … | |
Re: I suggest you make a much much shorter example (20 lines instead of 200). The inputs should be hardcoded. You should be able to clearly demonstrate and show us the input, the current erroneous output, and the expected output. | |
Re: Before messing around with tictactoe, you should make some examples for yourself to make sure you understand the basics. Create a string and output it. Does it look correct? Stringstream works just like "cin" (an input stream). Here is a demo: [url]http://programmingexamples.net/index.php?title=CPP/StringStream[/url] David | |
Re: It is highly unlikely that anyone is going to do this for you. You should instead ask "How do I do this?". The c++ forum is probably not the right place for this question anyway. Which GUI framework are you using? | |
Re: Welcome to DaniWeb! TO allow us to most effectively help you, please use code tags when you post code. Why are 'A' and 'result' their current size? Shouldn't they be much smaller if the code was written explicitly for 3x3 matrices? Also, about half of the code you have posted … | |
If I have this structure: [code] class Parent { public: virtual void MyFunction() {// do something} }; class Child { public: virtual void MyFunction() {// do something else} }; [/code] The Parent::MyFunction() seems to always be called, even with: [code] Child MyChild; MyChild.MyFunction(); [/code] Is this expected? David | |
Re: Please use code tags when posting code. Also, what is the problem? Please give us example input, current output, expected output, any errors, etc. | |
Re: You seem to have defined the add() function but not a unian() function? If this is just a typo, please post code that should compile so we can see the whole structure. | |
I am working on some code (not written by be, and too big to fundamentally change the structure of) where a pure virtual Image class is implemented. The user is expected to implement a function of their derived Image class with signature: [code] virtual Rgb* GetRgb(); [/code] Where the Rgb … | |
Re: 1) Be very careful, 'word' may be a reserved name on some systems. 2) You have declared an array of strings for 'guess' but I think you just want it to be one string? As Chilton pointed out, you have done this [icode]cin >> guess[50];[/icode] when I think you just … | |
Re: I suggest creating a function called OutputBinary(int lengthOfNumbers) and testing it by hardcoding a call to OutputBinary(3). This way you will be able to tell if the problem is with your output of if it is with your user input. | |
Re: 1) Use code tags. 2) include <iostream> instead of <iostream.h> 3) prefix cout with std:: 4) readb,c, and d must be void | |
Re: I would start by switching from char arrays to std::string and from strcmp to .compare - [url]http://programmingexamples.net/index.php?title=CPP/Strings/Compare[/url] [url]http://programmingexamples.net/index.php?title=CPP/IO/ReadingLines[/url] | |
Re: You can look into SDL - [url]http://www.libsdl.org/[/url]. | |
Re: For Linux, use gcc/g++. Then you will probably want an IDE such as KDevelop. | |
Re: I suggest simplifying this code as much as possible. That is, we don't need to see the encryption function at all to look for this problem. Typically by doing this, you will be able to see the problem yourself :) Also, explain the input, expected output, and current output. | |
Re: I think you're missing two semicolons: [code] #include <iostream> class Hop { protected: static struct NStrct { int nCount; } test; }; int main() { return 0; } [/code] | |
Re: I suggest trying to boil down your problems into very small demos. In many cases it will help you identify what is going wrong enough that you can solve it yourself. If not, it will produce a helpful question/answer pair for DaniWeb. Once you figure it out, if you don't … | |
I have been using a [icode]Image<Node>[/icode] as the main object to store the data for my program. It is a 2D grid of Node objects. The nodes have properties like [icode]bool Visited[/icode], [icode] float Priority[/icode], etc. I often want to modify these nodes, put some of them in a vector … | |
I realize this question may be impossible, but I'm pretty confused so I'm drawing at straws. I'm trying to use a class from a big library. If I do this: [code] TheClass imageIterator(image, region); [/code] everything works fine. However, if I do this: [code] TheClass imageIterator; imageIterator = TheClass(image, region); … | |
Re: If you want to use Qt it look like QConsole should do it: [url]https://sourceforge.net/projects/qconsole/[/url] | |
I have a class that has a function called Update(). I have written several different update methods, so I now have: [code] class MyClass { double Update1(); double Update2(); double Update3(); private: float Data1; ... float DataN; }; [/code] All of these functions need access to all of the data … | |
I'm having trouble with this "strict weak ordering". Consider a class Point with members x and y. I tried to make the comparison "If both the x values are less than each other and the y values are less than each other, the Point's are less than each other". However, … | |
Re: A statement like this: [code] cin >> Total_Number_of_Seconds%3600; [/code] doesn't make any sense. 'cin' is trying to read something from the input stream and store it somewhere. Storing it in "variable%3600" doesn't make sense. Just store it in "variable". [code] cin >> Total_Number_of_Seconds; [/code] David | |
I am trying to return a vector of some of the elements in a vector. I wish to modify one of the elements in this new vector and have it automatically update the value in the original vector. I tried this: [code] #include <iostream> #include <vector> class TestClass { public: … | |
Re: You could look into SDL ([url]http://www.libsdl.org/[/url]). I know you can play audio files, not specifically sure about mp3s. Also, please use real English words like "please" instead of "plz". It helps to keep DaniWeb looking professional! David | |
Re: VTK has some Geoviz capabilities: [url]http://www.vtk.org/Wiki/VTK/Examples/Cxx#Geographic_Visualization_.28Geovis.29[/url] but there may be better tools for this job. | |
Re: I'm assuming you want to take numbers like 10.0 and 9.0 and output them such that they look like 10.0 9.0 If that is correct, it would be a perfect project for you to figure out how to do that and then add it as an example here: [url]http://programmingexamples.net/index.php?title=CPP[/url] David | |
Re: That error likely means you are accessing an index outside of the contents of a string: [code] string a = "hello"; // valid indices are 0-4 cout << a[7]; // should cause that error [/code] Check the bounds of your loops, etc. David | |
On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] I have a <ul> element (the menu bar) followed by a <p> element (the main body text). Shouldn't the <p> be below the <ul> since it is a block element by default (instead of on the same line as it, as it is now)? Thanks, David | |
What I really wanted was a single class, ImageSegmentation<T> that operates on images of type T. The problem was that this object needed to be a member of my Qt form object (called Form), but I didn't know T until runtime (the user selects which type of image to operate … | |
Re: This is another one of those "common" questions that I am recommending cataloging: [url]http://daniweb.uservoice.com/forums/62155-general/suggestions/830529-create-a-wiki-to-catalog-answers-and-examples-?ref=title[/url] Please vote for it! Dave | |
Re: Have you gone through the tutorials here : [url]http://nehe.gamedev.net/[/url] (on the left side there are 52 OpenGL tutorials.) Once you distill some of that, if you could add some short code snippets here which demonstrate very particularly functionalities: [url]http://programmingexamples.net/index.php?title=OpenGL[/url] that would be a great exercise for you and very helpful … | |
Re: Hi Banh, welcome to DaniWeb! The istringstream is a stringstream - it lets you "manipulate strings as if they were input/output streams." [url]http://www.cplusplus.com/reference/iostream/stringstream/[/url] You don't show how you have defined 'initial', but atoi could probably be replaced by another stringstream operation. Also, please use code tags when posting code. David | |
Re: [code] for (i=0;i<4;i++) { for(j=0;j<4;j++) { cout<<list[i][j] << " "; // put a space between the characters on the same line } cout << endl; // start the next line } [/code] | |
Re: "calling the condition function gives me error" - what is the error? There should be no problem calling a function from another function. | |
Re: stankefa, Welcome to DaniWeb! Try commenting line 23 and 24. You should see only the copy constructor called. On line 23, you are calling f(), so of course it will be called! Also, in the future, please use a descriptive thread title - for this question maybe something like "Copy … | |
Re: Welcome to DaniWeb. To help us help you most effectively, please use a descriptive thread title. Please also use code tags when you post code. It looks pretty "compact" (aka hard to read!) already to me! David | |
Re: Please post your code directly using code tags. Preferably, simplify the code as much as possible so that it only demonstrates the relevant parts. | |
Re: Why are you using [code]string term[]={"Jordan"};[/code] ? Why not just [code]string term = "Jordan";[/code] Also, why do you have quotes around[code]"term[i]"[/code] ? | |
Re: 1) I've seen something like this before: [code] class OSG_EXPORT Group : public Node [/code] to indicate that the class is part of a specific library ( I think used for wrapping by other languages?) 2) [code] Group(const Group&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); [/code] I believe the first parameter is required and … | |
Re: What is the problem? Does it crash? Give the wrong result? | |
Re: You should definitely check out Qt. I have an introduction here: [url]http://rpi.edu/~doriad/Talks/Qt_Introduction.pptx[/url] and a bunch of examples here: [url]http://programmingexamples.net/index.php?title=Qt[/url] It will keep you pretty occupied! David | |
Re: I suggest you come up with a simple example problem, and then do the problem step by step by hand. Then step through the code with a debugger and ensure that it is doing every step the same as you did by hand. This will let you find the bug, … |
The End.