1,362 Posted Topics
Re: Better would be to use a system sleep function. The looping method will tie up the processor doing needless work (just watch TaskManager while the looping code runs) In Windows, you can use [code] #include <iostream> #include <windows.h> using namespace std; int main( ) { cout << "sleep" << endl; … | |
Re: Look at the code you have, divide it into chunks that make logical sense to be together. At a minimum, the input section and each of the calculations should be individual functions. You might have one function that groups all the calculations into a single call from the main( ). … | |
Re: Do virtual machines count? I could easily find myself running a VM on my main desktop, as well as the host OS, RDP into my machine at work which is also running a VM, and there's the laptop beside me. That's 5. | |
Re: I've found that compiling from the command line gives an executable that will stand alone. At least for projects with a single source code file. | |
Re: 6 on the beertender test. Common Sence Meter: 84 But should we put any stock in a "Common Sence" test? What's "sence"? | |
Re: Since you have a very formatted data, use getline to read up to the commas, and on the last item of the record use getline with no specified delimeter to get you to the end of line. You will have read each item, if only into a temporary string which … | |
It took the guy 5 years to record this all over the world and put it together [url]http://vimeo.com/moogaloop.swf?clip_id=2539741[/url] Turn up the speakers :) It runs a bit over 5 minutes | |
Re: As you can see, it's very hard to follow your code without the indenting. Please use code tags, like [noparse] [code] your code goes here [/code] [/noparse] And it would be clearer if you don't give us big blocks that are commented out - just show what's in your code. | |
Re: Does the error occur on the first line attempted read, on some line in the data file, the last line, or after the last line? | |
Re: you need to separate the parts of a for loop with semicolons, not commas. | |
Re: And, you are doing all the calculations before you have gotten the height value from the user. Get input Do the math Show results | |
Re: OK, you found the compile time error. Now, there's still a potentially fatal logical error to be corrected. | |
Re: In your count function, you have two basic approaches. 1 - Run through string 26 times, each time counting the occurrence of the corresponding letter. Keep track of the letter that has occurred the most. 2 - Run through the string once, incrementing counters stored in an array for each … | |
Re: I think those instructions are pretty clear. Create a class, that is derived from the string class. You will have to create your own constructor(s), the encryption method, and ideally input and output methods. See below for a general framework [code] #include <iostream> #include <string> using namespace std; class myString: … | |
Re: Works ok for me. And I see nothing about the search code that seem to cause any problem. | |
Re: And I'd like to know why one of the hits I'd least like to see is now the first listed - arghhhhh! It's a site that hasn't had an update to my info in over three years. That one used to be buried on the second or third page. | |
Re: Probably so. What happens if you delete or comment out that line? | |
Re: if (rand() < RAND_MAX/(h->N+1)) If you read the work closely, you know that N is the data member of the node that counts its descendants. Lets use N=10 as an example. The probability of assigning new node at the root will be 1/(10+1), or 1/11 (approx. 9%). To determine that … | |
Re: Look at where the first error occurs - is the variable aI in scope there? What's wrong with this pair (prototype and implementation)? [code] static double modifyInterestRate(); void Savings_Account::modifyInterestRate(double aI) [/code] Why are you using .print( ) the way you do, tacking it onto another method? Error 4 is probably … | |
Re: To display the file contents in your command window, you need the command "type". See the following example use. [code] #include <iostream> #include <dos.h> using namespace std; int main( ) { char str[] = "myfile.txt"; //put your filename here char cmd[50] = "type "; //note the space at end! strcat( … | |
Re: It's also said that married men live longer than single men. Actually, they live equally long. It just [b]seems[/b] longer to the married guys | |
Re: Why do guys like girls that wear leather? They smell like a new car. | |
Re: a. It looks like you're writing in all C - this is the C++ forum. b. What's your question? | |
Re: If you ran it by double clicking the .exe file, then it worked just as it should. The command window opened, displayed the output, then closed. Try opening a command window, navigate to where the .exe is, then run the program from the command prompt. | |
Re: Additionally, your search function looks to be sort of a Binary Search - but rather odd in its implementation. I suggest you look up binary search algorithm, I think it might be hard to prove correctness of your method. Also, you return 0 upon success and 1 upon failure - … | |
Re: Assuming there are no blank spaces, and all the data is on one line (no newlines in the data before the end)...you can use the comma as the delimiter in getline( ) to read in the text, then get your numeric values and ignore the commas, like so: [code] #include … | |
Re: Your problem lies here: [icode] for(int z=0; z<arraySize; z+3) [/icode] the statement [icode] z + 3 [/icode] does not change the value z. Perhaps you meant to say [icode] z += 3 [/icode] But that would not work well. z should be counting up by one, and your tests in … | |
Re: when passing the row from a 2D array to a function that takes a 1D parameter, use only the row index in your argument. [code] foo( test[0] ); [/code] That essentially passes a pointer to where that row begins. | |
Re: look [URL="http://lmgtfy.com/?q=cause+effect+analysis"]here[/URL] | |
Re: If you bought it "used, from a company", do you mean that it was previously in an office environment? It might be set up to connect to a domain, which you are not part of. Right click My Computer | Properties | Computer Name tab. Is it part of a … | |
Re: Firstly, using the >> method to read the student name assumes every student has a "one word" name, which is a bit unrealistic. If that is the condition of your problem, then consider [code] if( infile >> tempName ) { infile >> idNumber; // loading data from file for (int … | |
Re: line 8 should have test [icode]index < length-1 [/icode] As VernonDozier mentioned, the proper version of this has the swap after the inner loop has found the one and only smallest remaining item. Doing the swaps inside the inner loop should still give correct result, but it will make the … | |
Re: pay = hours worked multiplied by pay rate minus deductions It would help if you: a: more clearly/completely explained your problem b: wrote some code to solve the problem and point out where you're having difficulty. Welcome to Daniweb. Please see the sticky posts at the top of the forum. | |
Re: [QUOTE=arbrophy;966333]I'm using Visual Studio 2008 and I don't see the 'Advanced' option in the properties menu. Is it hidden somewhere else?[/QUOTE] You realize you're responding to an old response to an even older thread? Better to start your own, you can refer to the past discussion. Here's what you should … | |
| |
Re: That's an OS created volume serial number. From the OP's question, I gather he wants the hardware serial numbers. This isn't really a C++ question, more an operating system one. That said, which Windows 64 bit - XP, Vista, Win7? Try SiSoftware's Sandra 2009 - it's 64 bit compatible, and … | |
Re: look at the various "find" functions that are part of the string class. | |
| |
Re: I've always been partial to Partition Magic, at least on systems up through XP. It allows you to resize all partions, essentially taking space from D and adding to C, moving the files as needed. | |
It's so easy to just beat a program into submission - keep hitting the compile button and let the system find your mistakes, work at them one at a time. But [URL="http://xkcd.com/371/"]machines have feelings, too[/URL]! Learn the age old art of "[URL="http://ironbark.bendigo.latrobe.edu.au/subjects/PE/2005s1/other_resources/desk_check_guide.html"]desk checking[/URL]". Your compiler will thank you for it. | |
Re: If you want it in the "like new" condition, you will have to format and reinstall the OS, because once you start using it, stuff gets added. If you're concerned about removing any traces of files you've deleted but keeping the ones you still have active, look for a diskwipe … | |
For those who have owned British cars or bikes this is a good twist on an old story. ELECTRICAL THEORY BY JOSEPH LUCAS Positive ground depends on proper circuit functioning, which is the transmission of negative ions by retention of the visible spectral manifestation known as smoke. Smoke is the … | |
Re: Two problems in one statement. [code] game[x][j]=='X'; [/code] First, you're using the equality test ( == ) instead of assignment ( = ). Second, you're trying to assign a character to an integer variable. This will work (when you fix problem 1) but will not give you the result I … | |
Re: Ouch - I'm getting a headache just thinking about a recursive 2D function - but it is a technique used in maze running problems. Your main concern is determining your base case and determining in what manner you will modify the parameters in the recursive call. Concerning the array parameter, … | |
Re: It's work time. If the employee chooses to goof off during that time, that's a disciplinary matter. And....15-30 minutes to boot? | |
Re: Remember, "Seinfeld" was a show about "nothing". | |
Re: I don't suppose that JC Penney is really, covertly, behind the ad? All the legal fussing and fuming is for the stockholders' benefit (don't want them thinking the brand's gone rogue), all the while every legal bombast brings the ad to people's attention even more. Despite being pulled, one can … | |
Re: Similar wording is in many of the Apple licenses, including iPods and iPhones. Now there's a threat, as seen at : [url]http://gizmodo.com/5016947/berkeley-group-uses-iphone-to-control-uav-squadron[/url] | |
Re: First look at the discussion [URL="http://www.daniweb.com/forums/thread215615.html"]in this thread[/URL], which as of this writing is right below yours. Then write some code, post it, and we'll go from there. | |
Re: You're on the right track, but not really moving all the songs following the deleted item up. You only move the i+1 element to the i postion when the match was found. Everything past that will remain where it was. That is, if the list is 1 2 3 4 … |
The End.