1,177 Posted Topics
Re: There are a few problems. 1) You must #include <cstring> in player.cpp to use strlen 2) you have not given us main.cpp 3) You have declared wait() in globals.h, but not implemented it anywhere. Once you fix those we can start to look at the multiple definition of 'player'. Multiple … | |
Re: Welcome to Daniweb! First, please use code tags around your code, it makes it much easier for us to read. Second, I STRONGLY recommend that you use std::vector instead of c-style arrays. It will save you hours of headaches for sure. Good luck, Dave | |
Re: With first one, it looks like you need to compare to 'largest' each time. That is, [code] if(num2 > largest) largest = num2; if(num3 > largest) largest = num3; if(num4 > largest) largest = num4; [/code] For the second one, I would suggest using more descriptive variable names so you … | |
Re: Is this "picture box" a visual studio thing? | |
Re: Are these [icode]ItemGroup^[/icode] supposed to be [icode]ItemGroup*[/icode]? If so, then I bet you are storing and using a pointer somewhere where you think you are storing and using the actual value. Dave | |
Re: You could look into the Boost RegEx package. Here is a short example [url]http://programmingexamples.net/index.php?title=CPP/TR1/Regex_Tokenising[/url] (maybe someone could comment /explain this a bit more)? Dave | |
Re: Welcome to DaniWeb! Please use code tags when posting code, it makes it much more readable for us. This question seems to appear over and over again. Maybe someone can make example here: [url]http://programmingexamples.net/index.php?title=CPP#I.2FO[/url] of "correctly" reading a file one character at a time as well as one line at … | |
Re: You should use getline() to get a line at a time as a string. Then you can use the [] operator to get each character and analyse it. Alternatively, you could use the std::count function: [url]http://programmingexamples.net/index.php?title=CPP/Strings/CountCharacters[/url] on each vowel. You may want to convert the whole string to lowercase (there … | |
Re: I haven't used it myself, but you could check out: [url]http://jocr.sourceforge.net/[/url] I urge you not to start from scratch, as this is quite a hard problem. Dave | |
Re: I would indeed try to make a "20-line" demo of the problem that you can post for us. | |
Re: Welcome to DaniWeb! First, please use code tags when you post code. It makes it much easier for us to read. Second, PLEASE do not use global variables. The assignment even says that you should return the value by reference. The actual error you are getting is because you have … | |
I hear perl is the way to go for string parsing, so here is the test! I have a file like this: [code] ... <li><a href="DSC_9866.JPG"> DSC_9866.JPG</a></li> <li><a href="DSC_9867.JPG"> DSC_9867.JPG</a></li> ... [/code] and I want to get a list of the file names. That is, the result I want is … | |
Re: tesuji is correct. You can only switch on int and char. I have demonstrated the difference between char and string here: [url]http://programmingexamples.net/index.php?title=CPP/Switch#Switch.cpp[/url] Dave | |
Hi all, I have started a wiki that I hope to make the "unofficial Daniweb wiki". Its mission is to present short, compilable answers to many commonly asked questions here on the forum. [url]http://programmingexamples.net[/url] I have seeded it with a handful of c++ examples, but I'm hoping that some of … | |
Hi all, I have started a wiki that I hope to make the "unofficial Daniweb wiki". Its mission is to present short, compilable answers to many commonly asked questions here on the forum. [url]http://programmingexamples.net[/url] I have seeded it with a handful of basic operations. Please feel free to edit, add … | |
Hi all, I have started a wiki that I hope to make the "unofficial Daniweb wiki". Its mission is to present short, compilable answers to many commonly asked questions here on the forum. [url]http://programmingexamples.net[/url] I have seeded it with a handful of c++ examples, but I'm hoping that some of … | |
Re: I strongly suggest trying to narrow the code down to the smallest piece that will give you that compiler error. From what you've posted, I can't tell that Xnode, Ynode, and arc are defined anywhere that the compiler should know about. Why are you using this ghastly define? Why not … | |
![]() | Re: There are "disassemblers", that will go from an executable to assembly, but you'll never get back to c++ :( ![]() |
I am trying to rally some troops to make some additions to WikiVersity - anyone interested? [url]http://www.pledgebank.com/openeducation[/url] Dave | |
Re: What is wrong with it? Give us a sample input, current output, and expected output. Does it crash? If so, have you used a debugger to track down where? Dave | |
I've seen that a vector can be sorted using [code] vector<double> V; vector<int> Index; V.push_back(9); V.push_back(10); V.push_back(8); Index.push_back(0); Index.push_back(1); Index.push_back(2); sort(V.begin(), V.end()); [/code] If I want to sort Index according to how V was sorted, there is an optional third parameter to sort() that will do this. I don't understand … | |
Re: If you store your new structs that AncientDragon suggested in a std::vector, you can then use sort() from STL <algorithm> Dave | |
Re: You can't! I supposed you could convert the int's to strings and push them all in as strings. What are you trying to do? I bet there is a better way. Dave | |
Re: anita_jojo20, Welcome to DaniWeb! Let me offer a few suggestions that will make your time here as useful as possible. Please use only real English words. I.e. 'plz', 'meeeeee', 'tx' are not words. griswolf seems to have provided an excellent description of the through process you should be using. I … | |
Re: Good question. Place the code between code tags, like this: [ code] here [ /code] (without the spaces between the brackets and the words) | |
Re: You may find more help here: [url]http://www.eclipse.org/forums/[/url] | |
Re: Linux has the concept of pipes to communicate between executables. Since you are saying "exes" I'm assuming you're in Windows, in which case I have no idea. You could always write to a file from program A and then read the file from program B, the problem would then be … | |
Re: Do you have a specific question? Please post your attempts at these things and we'll try to help you debug them. Dave | |
Re: Not that we would do your project for you even if we have the details, but wit the information you have provided we can't give you any direction at all! | |
Re: Welcome to DaniWeb! Can you please be more specific? Maybe looking at ifstream and ofstream will get you started? Dave | |
Re: wxWidgets is a GUI system. Here is an example: [url]http://www.wxwidgets.org/docs/tutorials/hello.htm[/url] You have to run [code] wx-config --libs wx-config --cppflags [/code] to get the settings from your system. Then you have to setup your build. I use cmake, so this is how to do it in cmake: [code] cmake_minimum_required(VERSION 2.6) PROJECT(Basics) … | |
Re: Please try to delete code until you are left with the shortest program that demonstrates the problem. For this type of error, we don't need the logic of the program, just the structure. | |
![]() | Re: You should use the count() function from STL algorithm [code] #include <algorithm> start = Vect.begin() ; end = Vect.end() ; result = count(start, end, value) ; [/code] (There is also a sort() function, but you shouldn't need it here) If you wanted to do it more manually you should use … |
Re: Why would a test driver confuse people?? That seems to be a very critical part of an example like this! | |
Re: Welcome to DaniWeb! Looks good to me. You should write a main function to instantiate the class and call the print function. Does it compile without errors and produce the correct output? If so then I think you're good to go! Dave | |
Re: You have to use ofstream, not just fstream. [code] else if (choice == 2) { ofstream outfile; // file declared outfile.open("output.txt"); // opening txt file cout << "Please set the following for your Log In information:\n" << "\nUsername: "; cin.ignore(); getline(cin, log.username); outfile << log.username << std::endl; // not sure … | |
Re: Welcome to DaniWeb! (First, please use code tags when you post code!) You should use a [icode]std::vector<std::string>;[/icode] Give that a shot and let us know if you have a specific problem. Dave | |
Re: Hi Andrew, Unfortunately I don't know the answer to your question. However, I urge you to make the titles of your threads as descriptive as possible. For example, I came to look at "A little problem", but quickly found out that it was related to the Windows API and I … | |
Re: That line is the constructor. It says to use a default value of 1.0 if nothing is passed. If something is passed, the [icode] : radius(r)[/icode] sets the member variable 'radius' to the value of 'r'. This is called an 'initializer list'. Dave | |
Re: Where does the error occur? If it is on this call [icode]ASN1_parse()[/icode] then you're question definitely needs to go to the OpenSSL community. Dave | |
Re: For that question, I'd start here : [url]http://www.daniweb.com/forums/forum4.html[/url] However, I'd ask why you would want to use such an old language? | |
Re: Both functions should simply return an int (by value). Simply change [icode] void FunctionName()[/icode] to [icode]int FunctionName()[/icode] and at the end of the function, after you [icode] cout << something;[/icode] now you need to [icode]return something;[/icode] | |
Re: I would look into a GUI system such as Qt4. This will allow you to make professional looking applications. Dave | |
Re: One helpful hint - please use a descriptive thread title, for example instead of "HELP!!!!!", say something like "Trouble with input and if statement". Dave | |
Re: I have a feeling that most of us geeks here are going to need a better explanation of what these rankings (0-3) mean, and a bit of an English explanation of what is going on before we can look at your code simulation. | |
Re: This error typically means that the file clientList.cpp is not linked to by the project. Try to produce the fewest lines of code that will produce this message and we can check if anything else looks wrong of if the project is simply mis configured. Dave | |
Re: Ganty722, Welcome to DaniWeb! I recommend looking into ifstream. Once you do that if you still have problems post the code of what you've tried here and we'll see if we can help you figure out what is wrong. Dave | |
Re: vsawant - Welcome to DaniWeb! Let me give you a few pointers to ensure your stay here is as successful as possible. 1) Please do not "hijack" threads. That is, your post here was not related to the original question. In this case, you should start a new thread rather … ![]() | |
Re: Do you have code to make a tree with 2 leafs per parent? Show us this and indicate where you think it would need to be modified to make more than 2 leafs, and we'll see if you're on the right track. Dave | |
Re: That is a pretty serious application! I would certainly not start out with something anywhere near that complex! I'm not even sure c++ would be the right language to start a project like that with. |
The End.