- Strength to Increase Rep
- +11
- Strength to Decrease Rep
- -2
- Upvotes Received
- 60
- Posts with Upvotes
- 57
- Upvoting Members
- 33
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
338 Posted Topics
Re: This program appears to be a merge of the 'have the computer pick a word and have the user guess it' and your 'number guessing' program. As written, the user doesn't have any interface to ask if the word contains a letter. You let them guess at the word and … | |
Re: I agree with grumpier, if you have to use the system() call, you're stuck with the "black window". But unless you're calling batch files, you can probably avoid the system() call. | |
Re: I like using random.shuffle() on the unused cards (or deck) and then you can just pop() a random card off the unused list. If you need to keep a used cards list, you can append the card you just got. When it is time to shuffle again, you can refill … | |
Re: And why are you posting in a thread last posted to in October 2007? | |
Re: This is the essential parts of the 'source' for the basic search form extracted from the web page you indicated: [code=html] <form action="/search.php#results" method="post"> <strong>Basic Search </strong> <strong>First Name:</strong><br> <input name="fFIRSTNAME" type="text" size="10" maxlength="25" value=""> <strong>Last Name:</strong><br> <input name="fLASTNAME" type="text" size="10" maxlength="25" value=""> </form> [/code] The <form> tells you that … | |
Re: So what are the 'given' parameters for the tree? Are all values in the tree guaranteed to be single digits? Is there a maximum depth limit? Ok, let me work this out 'on paper' so I understand it: {Note that spaces are preserved inside code tags.} Tree with 3 nodes, … | |
Re: attrib is a program, not an internal command. Either, the program has been removed or renamed or it is not in your path. Though it sounds like you have a more serious problem with the system. The BOOT.INI file is what Windows uses to determine where to find the windows … | |
Re: I agree with Comatose, you should probably put the part that prompts for and accepts new input inside the loop somehow. That way as the loop is run again you ask for input again. The psuedo-code looks something like: [LIST] [*]While the user has not guessed the number [*]Prompt for … | |
Re: Putting code in headers is generally bad form....if you include that same header in more than one file in a compilation unit you get duplicate symbols. The original layout of the files should have worked, did you include myfile.obj or myfile.o when you compiled main.c? | |
Re: Well, I personally prefer to help with code that will at least compile... Your original lines 36-39: [code=c] status = fscanf(filep, "%d%d%d%d", measuredp->site_id_num measuredp->wind_speed measuredp->day_of_month measuredp->temperature; [/code] are missing the closing ')' for the function call and the ',' separating the arguments. What dragon was referring to was that with … | |
Re: I'm thinking that your problem is actually the format character in the last printf. '%d' is for decimals/integers. Try using a '%f' instead. | |
Re: I googled the function name and came up with this description: [quote] The function cvCalcOpticalFlowBM calculates optical flow for overlapped blocks blockSize.width×blockSize.height pixels each, thus the velocity fields are smaller than the original images. For every block in imgA the functions tries to find a similar block in imgB in … | |
Re: What part have you written and/or what specific question do you have? - Did you get the binary file open? - Did you fill the vector from the file? - Did you find the start point of the string? - Were you able to append characters to your string from … | |
Re: I'd like to experiment with the code to try it, but in the interest of a quick answer, try [icode]low < mid[/icode] on line 20 and [icode]mid < high[/icode] on line 25. Basic translation: If there are values between low and high that are lower than mid, add them to … | |
Re: You're going to have to save the operands that you show the quiz taker so that you can actually perform the math to see if they give you the right answer. Right now, in CheckAnswer, you re-generate two operands and add them together. If the user happens to have entered … | |
Re: I found this code example [code=Perl] use Getopt::Long; my $data = "file.dat"; my $length = 24; my $verbose; $result = GetOptions ("length=i" => \$length, # numeric "file=s" => \$data, # string "verbose" => \$verbose); # flag [/code] at [url]http://perldoc.perl.org/Getopt/Long.html[/url] (The first page returned for google "perl getopt long") If you've … | |
Re: It was my understanding (and I did a little searching that didn't disagree) packets sent to 239.255.255.255 should be available to anyone with a 239.x.x.x address. Does your computer have a 239.x.x.x address? Are you listening to the right port? | |
Re: So you don't want to append to the file, you want to update its contents? How many files are there? One per team? One per player? One per stat? If the file is in ASCII form (like your sample stat was) and you need to update it, you will likely … | |
Re: Think about it...how would YOU do it? All you really have to do is additional testing in the year they would turn 18. If they would turn 17 (or younger) this year they fail. If they would turn 19 (or older) this year they pass (they're already 18). If they … | |
Re: If you were given the assignment to do it by hand, how would YOU do it? (The manual process makes a good basis for the pseudo code for the computer.) | |
Re: did you mean to save the key and value pairs you read in so you can search them when you open the second file? | |
Re: I'm not sure what the question is. You declare a pointer to an object of the appropriate type on line 17, in most linked lists I've seen, it is usually named "next" but other than that I don't see a problem. You do appear to be declaring one on line … | |
![]() | Re: You want to put the date and time in the title of the window that pops up, or do you want the name of the directory to contain the date and/or time? For getting the date/time into a string, you might look at strftime() and you should probably also consider … ![]() |
Re: It was a link to another thread that explains why not to use eof() in your while loop condition. Click the link, read the thread and implement the change. | |
Re: line 24 is passing the address of a function to scanf? I think you meant [icode]scanf("%f", &inch);[/icode] line 35 you need to pass the address of restart [icode]scanf("%f", &restart);[/icode] | |
Re: I wouldn't have written it in the same way, but I think your problem is two-fold: First, you never set an initial value for [ICODE]DivSales::totalSales[/ICODE] so it's initial value is undefined. Second, line 21 of DivSales.h where you think you are adding to the total, [code] totalSales =+ q0+q1+q2+q3; // … | |
Re: the [ICODE]ifstream fin[/ICODE] on line 48 inside readin() is NOT the same as the stream of the same name that is declared on line 20 and opened on line 24 in main(). You either need to open the file in readin() or pass the stream from main into readin(). | |
Re: You put your variable definitions in a .py file you could name it definevble.py if you wanted to. Then from the other python file (.py) that wanted the variables you add a line: [code=Python] from definevble import * [/code] That imports everything in that file into this file. I think … | |
Re: I've never actually done it for a website, so you may want to take this with a grain of salt. The concept is that as a user is added to the 'database' of users, you generate a random 'validation value' that is also stored with the user. You then generate … | |
Re: If you don't intend to use any of the predefined C++ data types in your implementation, what do you propose to use? A 6000 byte long number could be implemented, I would probably use an array with 6000 elements, but that still uses base C++ data types. (Ignoring the fact … | |
Re: So you just want to output the percentage calculation for heads and tails? Wouldn't you just divide the number collected by the total sample size? | |
Re: I don't want to spend the time to figure out if your program does exactly what the spec calls for, I'd rather help you get your program to do what you expect. What are you seeing it do that is unexpected? (What are the symptoms) You might want to add … | |
Re: In C# a function can return only one value. You're passing the fraction into the simply function as a numerator and a denominator and the function is unable to return both. Alternatives would be to 'package' the numerator and denominator into a struct or class which you could pass in … | |
Re: You don't want the 'foreach' on line 9, you don't want to add a record to the database for every field on the line. and presuming that the construct [icode]cmd.Parameters.Add("@acc", SqlDbType.NVarChar).Value = part[i];[/icode] makes sense (I've not seen it before so I'll trust you that it will work). You will … | |
Re: There are several options, most of them make the protocol significantly more complex. The goal would be to verify the client and/or the response. You could start each conversation with some kind of challenge and response. Where your code would know how to respond and a fake client would have … | |
Re: I'm almost certain you have to make a copy of the data to do what you're trying to do. Depending on the database and the size thereof, attempting to load the entire database into an array might not be your wisest design decision. Here are a few questions to help … | |
Re: Show us what you've done... [url]http://www.daniweb.com/forums/announcement118-2.html[/url] | |
Re: It would depend on how smart you want the computer to play. The smarter you want the computer to be, the more work it will be. You will likely end up adding a function that will 'make a move' like the player1() and player2() do. A simple implementation for the … | |
Re: How would you solve the problem manually? I want to withdraw $180, what bills would you give me? How did you decide how many to give me? Ok now make the computer do it... Write some code that asks how much to withdraw. Add a print statement that outputs what … | |
Re: 200 lines of code is not unreasonable to post, you should just have posted it in code tags. (There are lot of people that won't download code. I don't do it very often.) The "vecA" files would be fairly straight forward to do after the loop that does the calculations, … | |
Re: I apparently wrote this while Ryshad was replying. He covers most of it in a more elegant fashion, but I'll post it anyway. Local variables work like you mentioned your [icode]i[/icode] did in VBA. If you declare it in a function, it goes out of scope when the function ends … | |
Re: You're iterating too far. The element indexed by [icode]cnt[/icode] wasn't fully read. On Line 25 the loop limit should be [icode]i < cnt[/icode] not [icode]i <= cnt[/icode] | |
Re: I think your problem is that you don't read the records from the file when you're making changes to them. For example if the first thing I did after starting the program was to check-out or check-in a book, I select menu choice 2 and this is the code: [code=c++] … | |
Re: Why don't you want the memory set to zero? Are you trying to extract some 'previous' value from the memory? | |
Re: You need to associate a method with the button's "on click" event. The code in the method will need to generate the textbox. (Did you mean a message box?) If you want more detailed help you're going to need to tell us more about your code environment, and preferably show … | |
Re: I don't see anything obvious about the login...maybe you could describe the problem you're having better? As not all of the code required to validate the login is shown, I'm presuming that all of the variable declarations are ok and that the user input for the login and password don't … | |
Re: When asking for help, please describe the symptoms you do see (if any). For debugging purposes, you should add some print statements to your code to confirm that you are getting the data you expect, where you expect it and for progress messages so you can tell where you stopped … | |
Re: Posting the code (in code tags) would have saved a lot of description of 'how you solved' the problem and given us a chance to actually help you. I think I understand the symptoms of the problem fairly well (and that's a good thing to include when you're asking for … | |
Re: I wouldn't use multi-threading in this type of application. You might look at using something from the [ICODE]_spawn[/ICODE] family of functions using the [ICODE]_P_NOWAIT[/ICODE] setting in place of your [ICODE]system()[/ICODE] call. They start child programs, but do not wait for them to complete. | |
Re: His line 12 should have been [icode]++cnt;[/icode] Though I agree with a previous poster that you have 8 grades, and do not have an average or a letter grade in your input file, which makes his sample code flawed as it tries to read the average and grade. |
The End.