338 Posted Topics
Re: Were you using the formula from page 8 of the pdf? Shouldn't it be more like this? [code=python] return (0.0 + c - min(a, b)) / max(a, b) [/code] I could be wrong, it wouldn't be the first time (grin). | |
Re: First, the directory structure shown by walk doesn't quite appear to match what you said the structure would be. For example, the directories under Library appear to be prefixed with a number (as in 1_Vrijstaand). For another example, the files under the individual directories don't show the 1_simple.max, 1_detailed.max, 1.csv … | |
Re: So the first file defines the 'encryption' The second file contains the 'message' to be encrypted. The third file you are supposed to generate as the encrypted message? If so, you will need to open and parse the first file, using the data you find to develop the translation. I … | |
Re: Actually, it should never get to that print line...it returns from inside all over the function. (Though I'm not sure that the returns in all of the test are required.) Is the board required to be in an [ICODE]int tttb[3][3][/ICODE] or could we store it in an [ICODE]int tttb[9][/ICODE] and … | |
Re: const is a 'promise' not to change. If you have member-functions that do not change your class (and never should) you can declare them const. const member-functions are declared like this: [code=c++] int getValue() const; [/code] The primary purpose for const member-functions is that they are the only member-functions you … | |
Re: Ok, just to make sure I understand, you're running on computer A and can telnet to computer B. You want computer B to telnet to computer C? Why not telnet from computer A to computer C directly? If the above A -> B -> C scenario is what you're trying … ![]() | |
Re: Optionally, unless the requirements specifically require that you use a 6 by 6 matrix internally, the program could continue to store the grid in a single list. The internal program structure of your data does not [U]need[/U] to be the same as the external representation. Use the internal structure that … | |
Re: Ok, so you appear to have some code there already. I don't see any notes there about what you want to do that needs more developers. Where are you wanting to take the project that you would like to have help with? (If I offered to help, what would you … ![]() | |
Re: No the problem is with python...you can't run python code without having python installed (or using the large python dll that has all of the python stuff in it.) The python code expects that all to be there. If you want to reduce the size of what you're shipping, you … | |
Re: Your goals are still VERY vague, but the bottom line is that for most peer-to-peer chat programs, you will open a socket between the two computers. Whether they hold the socket open (likely) or open and close it is an implementation detail. To get the socket initially established, one of … | |
Re: Where is the declaration of com_num in relation to the order function? com_num needs to be visible to any compile target that can see order. What specifically is the compiler error? Which is the line that generates the compiler error? | |
Re: The 'link to problems' you give is to the w3.org validator for the site. The first error listed is [icode]Line 24, Column 21: document type does not allow element "div" here; assuming missing "li" start-tag.[/icode] The relevant section of your html is here: [code=html] <ul> <li></li> <div id="texto1">****** | home … | |
Re: Please when posting to these forums, wrap your code in code tags (like daviddoria did above). Use either: [noparse][code]...[/code][/noparse] or [noparse][code=c++]...[/code][/noparse] The second form provides for syntax highlighting and line numbers. | |
Re: Side comment - with 18 post under your belt, you should have known enough to wrap your code in code tags. [noparse][code] ... your code here ... [/code][/noparse] at least, but for this forum, preferably [noparse][code=c#] ... [/code][/noparse] | |
Re: I agree that I generally don't use the this pointer. About the only time I use it is when I call a method or function outside of the class that needs to refer back to my object. An example might be registering my object with a 'server object' for callbacks. | |
Re: In the ZIP file, student.h still contains: [icode]SinglyLinkedList<CourseInfo> courseList;[/icode] so the student does NOT contain a linkedStack. If you want it to contain a linkedStack, you have to tell the compiler by changing the line. | |
Re: do the overloaded operators need to be implemented as members of the class, or could they be implemented 'outside' the class? (I think in class may be required or recommended) Do you need to have the operators return a value? | |
Re: If the code you want to call belongs to an object on the same page as the javascript, I think you can make it work. If the javascript is running in an embedded browser and you want it to call code in the surrounding application, I don't think you can … | |
Re: I thought AncientDragon explained it pretty well. Your assignment is to create a couple of functions which implement the menu options 'A' and 'B'. When you're done, the person running the program shouldn't be able to tell that you have made any changes, the program should still behave as it … | |
Re: It might help if you could write (in your own words) what it is that you think you need the program to do. The first example looks something like: There are 10 (or N?) input files with line-oriented records. Each input line contains 4 fields. Generate an output file that … | |
Re: @starzstar I think the module you're looking for it getopt It is designed to parse command line arguments and handles the type you indicated. @keerthihm You should probably have started your own thread and not replied to this one. You seem to be asking about testing a binary tree. Which … | |
Re: As this appears to be your third post on the same topic (different forums) in less than a week, I have to ask, did you read the FAQ's? We will generally not provide a canned solution for you, we will help you to develop your own solution to the problem, … | |
Re: Thanks for using [noparse][code][/code][/noparse] tags, but your formatting could still use some work :) If you use [noparse][code=c++][/code][/noparse] tags, the code will have line numbers and syntax highlighting. The first section trying to validate input: [code=c++] cout << "Please enter in your desired amount of lines for your"<< endl; cin … | |
Re: Just a comment: [code=python] return len(possibles) / len(winners) * 100.0 [/code] Calculated the wrong percentage I changed it to: [code=python] return 100.0 * len(winners) / len(possibles) [/code] | |
Re: The code [code] cout << "It will take " << W.getDays() << " days and " << W.getHours(); << " hours of time." << endl; [/code] should only have one ';' after the endl. The one after W.getHours() does not belong. | |
Re: TestClass has no means to find the DbConfig declared inside main. If TestClass needs to access it, that DbConfig must either be given to TestClass as a parameter of some sort or if having one and only one DbConfig would be proper, you could provide support for and access to … | |
Re: problems in fnAddDepartment(): [code=c] fgets(ArrTemp, ARR_TEMP_SIZE, stdin); for(iLength=0; iLength<ARR_TEMP_SIZE; iLength++) { ArrTemp[iLength]=Dept_Name[iLength]; } [/code] The first line gets input into ArrTemp, the remaining 3 lines overwrite the input with the previous name (which at the time it is used is undefined.) You should be using looping constructs inside fnAddDepartment() and … | |
Re: The limit for the 'i' loop in bubbleSort() is interesting, but it appears that it would work. You will probably need to allocate the array and fill it with the data you read from the file. Then you will need to call bubbleSort() and pass it the array and the … | |
Re: Whether or not the source is available for a given library is up to the developer of the library. If the source files are not included, you can't step into them. (Unless you like to read disassembly.) If the library is only released as a dll, the same applies. If … | |
Re: Looks like a nice homework problem, maybe if you put some work into it first, you might actually get an answer. See [URL="http://www.daniweb.com/forums/announcement114-2.html"]Homework Help[/URL] When you start posting code so we can help, use [URL="http://www.daniweb.com/forums/announcement114-3.html"]code tags[/URL] If you have absolutely no idea where to start, show us your design (how … | |
Re: I agree with all of Lerner's comments. I decided your problem looked like fun so I decided to try and get it to compile on my system. What Compiler are you using? What is your target Operating System? (My compiler didn't have support for the BGI graphics so I had … | |
Re: I've always thought that the 'snake' collision detection just looked at the next square the snakes head was going to be put. If there's something in the square, its a collision. If its food, the snake eats it and that's a good thing. If it's wall or part of either … | |
Re: I don't think you can use scanf and meet those criteria, scanf will not accept spaces. I suggest using fgets and parsing the line you get back to validate. | |
Re: Did you mean to loop until both were dead, or until one was dead? [code=c++] while (hp >=1 or enhp >=1) [/code] Reads (in english) "While the player health is at least one or the enemy health is at least one, keep fighting" I think you wanted to stop if … | |
Re: Your class has space for 4 class names and 4 grades. But when you accept input from the user, you read a class name and then 4 grades for that class. Then you read the next class name and 4 grades for the second class. (But you store the 4 … | |
Re: Rephrasing one of your if statements into english: [code=c] if (d>=21 && d<=19 && m==3 && m==4) [/code] That reads: If the day of the month is both more than or equal to 21 and also less than or equal to 19 {this is impossibility one} and the month number … | |
Re: From my first glance at your problem, it would appear that the first line is a 'special case' as it does not have spaces at all (which would work as the zero spaces case) but the 'left side' and the 'right side' are not mirror images of each other. Someone … | |
Re: I wasn't in your original chain...but I'll try to help. (I ended up compiling and running your code in the debugger) Your problem is that you have a pointer to a pointer and you're indexing off the wrong pointer. I changed your code: [icode]fscanf(f1,"%d ",&pcall[i]->day);[/icode] to this code: [icode]fscanf(f1,"%d ",&(*pcall)[i].day);[/icode] … | |
Re: As we stated in your previous thread, we will help you if you put in some effort, but we don't solve your problems for you. When posting c++ code, please use c++ code tags [noparse][code=c++] // Your code here [/code][/noparse] Just pick one function at a time and write them. … | |
Re: We don't do 'code to order' feel free to post your code and we'll help you work through your problems. Or ask a much more specific question like 'How do I open a file'? if you can't find it on google (or equivalent) | |
Re: Once you have both of those, you can use the two numbers to calculate the total weight of the widgets. And if you know how much all the widgets weigh and how much a single widget weighs (and at this point you would know both of those) you can calculate … | |
Re: We're having a communication problem. We are recommending that you create in memory a copy of what you want the file to contain. You are being specifically advised against trying to 'edit' the file as the user types keys. The memory 'buffer' is what the user will edit. They can … | |
Re: Q2 is a slice construct I had not seen before. Apparently the full slice spec is [start : end : step] so [::-1] says I want the whole string stepping backwards. You can slice any list or string...play with it, it is a fun syntax. It can also be used … | |
Re: Same result here. You need [icode]#include "person.h"[/icode] in student.h because Student derives from Person. | |
Re: (*rats I wasn't first reply :( *) [ICODE]int i,j surname[N],name[N],ID[N],grade[M][N];[/ICODE] Declares all of those variables as integer. Should some of them have character data? The format in [ICODE]scanf("%s",name,surname,id)[/ICODE] will only read one string value. surname and id will be empty. (But as noted above, name, surname and id are all … | |
Re: Comment on your first code segment: I would have been tempted to use fgets() but your code should work. Second and Third code segment: The following will always subtract 65 (which is the ASCII code for 'A'). Is there any time you wouldn't want to do it? (For example, if … | |
Re: When posting c++ code, please use c++ code tags [noparse][code=c++] // Your code here [/code][/noparse] In the line: [code=c++] len=(int)log10(num)/log10(base)+1; [/code] the (int) is binding to the log10 call rewrite the line as follows to get the logs divided before taking the int: [code=c++] len = (int)(log10((double)num)/log10((double)base))+1; [/code] The casts … | |
Re: You REALLY need to move this to an array... From the text printed next to answer3 and answer4, what you really need is something more like this: [code=c++] if (num1 > 0) { answer3 += num1; } else { answer4 += num1; } [/code] and repeat it for the other … | |
Re: There's no real difference in how the symbol is treated other than the fact that the compiler would allow you to modify argv in the second example. (Not that modifying argv is a good idea.) The first example should complain if you tried to do [icode]argv++[/icode] but the second example … |
The End.