2,045 Posted Topics
Re: Call [icode] srand((unsigned)time(0)) [/icode] only once before your first call to [icode] rand() [/icode]. This seeds the random number generator with the current time. You'll need to include [icode] ctime [/icode] (formerly time.h) for this. | |
Re: On line 34, why do you have your else within the braces of your if? What the compiler is telling you is that there is a path through that method (the path taken if [icode] x >= rows || y >= cols || x < 0 || y < 0 … | |
Re: [quote]Question What are the style quote-tags?[/quote] You're misinterpreting. He means ">> style" "quote tags" (quote tags in the style of >>) not ">>" "style quote tags". (just for clarification, not to steer this OT) | |
Re: @AD Since his application is on the CLR, it's probably easier to incorporate all of this as a BackgroundWorker class. @OP Check out [url]http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[/url] and scroll about halfway down to "Examples" and make sure you have the C++ tab selected. It's not identical to what you are doing but you … | |
Re: I don't know that it's going to be possible to do with Dev C++ (which is outdated as it is, and won't offer you a GUI designer nor the .NET libraries). Grab the VC++ 2010 Express Edition. The dialect used in this case is C++/CLI and is probably not a … | |
Re: Please post your code, as you are probably on the right track. Think of how you would do it in life. Change is 1.01, how many dollars? 1. Remaining change 0.01. How many quarters? 0. dimes? 0. nickels? 0, pennies? 1. Remaining change, 0.00. What would happen if the change … | |
Re: [QUOTE=quicktpgo;1191334]I like The Big B[B]o[/B]ng Theory right at the moment. Sheldon is so geek!^^[/QUOTE] Is that a different show than the one on CBS? ;) [isarcasm] Careful, material like that is going to mess up your sig link hits. [/isarcasm] | |
Re: Try plain old "Curl" it comes as an .exe file (it still has some learning curve, but you don't have to compile anything). Go to [url]http://curl.haxx.se/download.html[/url] and pickup one of the binary packages. Also, if you are trying to use C++/CLI, then a reference on .NET's methods for C# would … | |
Re: If you are using C++/CLI you should be able to use the Regex portion of the .NET library. See [url]http://msdn.microsoft.com/en-us/library/3y21t6y4.aspx[/url] for the namespace and syntax. If you're trying to do it to native C++, Taywin is correct, and you'd have to find a library to do your Regex processing (I … | |
Re: You could have check answer return a 1 (for 1 correct answer) or 0 (not a correct answer) and have doOneProblem return that to the caller. Where is num_of_problems defined in main()? It's not. Take a quick look at your book's section on scoping. You are not calling getProbsperset with … | |
Re: What are the compilation errors that you are getting? Note that among other things, your call to the putel() method in main doesn't take the same number of parameters as it does in the class definition. Also, with your out of bounds checks you place the element or return it … | |
Re: Please use code tags [noparse][code]//code here[/code][/noparse] next time. Hint, use an if statement to either increment your index (value doesn't match with other) or leave it the same (if it's a duplicate). You will probably need to shift your while loop around to reflect this (and base its condition on … | |
Re: Yes, it's the same. Structs and classes in C++ only differ by the default visibility of their elements (public for structs and private for classes). | |
Re: Pass your after pointer to your temp_ptr's setNext method, something like [icode] temp_ptr->setNext(after->getNext()); [/icode] | |
Re: I know it's not the answer that you want, but google for "macro recorder," and you can probably save yourself a lot of coding. I really don't know how to direct you to begin, but since this is one of those gray areas of computing, see if there's another way … | |
Re: Check line 58 of the CPP file versus what you have in the header. They don't match up. | |
On my post count graph in the profile it lists all the weeks and then it puts an entry for Jan 3rd at the very end. See screenshot below from when I mouse over it. I'm not sure where this is coming from as it doesn't represent any kind of … | |
Re: Seems to me your line class should contain the start and end points for a line. Then pass in a point to your "distance" method in Calculating. Seem like you might want a Point class too, perhaps... | |
Re: What have you tried so far? Which parts are giving you the hardest time? No one is going to be able to help you without some effort from you first. | |
Re: It's probably in the same location as the .exe file. Either go to the directory into which you started the project or use Window's search utility to find it (you may have to expand the search area to include more than your documents, etc.). | |
Re: Use of the "dis" function (or a series of [icode]cout[/icode] statements) at strategic points in your program will let you trace it through step by step (or step through it using a debugger if you have one). If you then write a couple of sentences, someone can look at it … | |
Re: Hint: what if your name input is not matched by the first line of the file? If they don't match keep going, reading in lines until it does. You need another loop. Using "out" as the name of your input file might be confusing to someone (or you!)trying to read … | |
Re: [QUOTE=Nick Evan;1179151]>> What time is it? [URL="http://www.youtube.com/watch?v=otCpCn0l4Wo"]Hammertime[/URL]![/QUOTE] You can't tell me he's not still the hero of millions of Dutch school children, Niek. | |
Re: Look at the condition on line 54. What happens when all of the sides are equal? Try testing for equilateral first. Also, while you are restructuring the loop, what happens when L1+L2 <=L3 (I think you tried to account for it but be careful which if/else pairs are associated with … | |
Re: Peter is an actor, I believe. The answer's on Wikipedia (WaltP, you shouldn't trust that this generation of trivia buffs won't look lol) I won't spoil it. | |
Re: That must be a percentage measured in metric. Just kidding. :) | |
Re: Is there any requirement as to the ordering of the videos, or is it first entered goes into slot 0, etc? The spacing issues and slashes are just basic modifications to your cout statements, what specifically are you having problems with in that department? | |
Re: Hand trace through the do/while loop with different conditions and you'll see that even if gender was equal to one, it would not be equal to 2 and vice versa, therefore your loop condition is true and the loop continues. | |
Re: To get something with similar function names and parameters try [url]http://codecutter.org/tools/winbgim/[/url]. It's terribly outdated and you'd probably have to rebuild it with VC++ (I haven't used it with either compiler so I don't know). Otherwise, David's and Mike's solutions are probably one of your better options. If you search around … | |
Re: When you give cin a bad input for "value" (e.g., 't' in your example), the stream goes "bad" and you need to issue a [icode] cin.clear(); [/icode] after line 32 to reset it. See [url]http://www.cplusplus.com/reference/iostream/ios/clear/[/url] (the example is for a file stream, but it's the same idea) | |
Re: Why are you using methods meant for C-style strings (strcpy and strcat) when you are using std::string objects? Otherwise the gist of all the inputs and outputs looks ok. Look up the substr and find methods and what they give for results. Hint: the += operator will be helpful to … | |
Re: I think it's your formula. When I did it old school style by finding the mean and summing the square of (each element - mean), and dividing that sum by n, I got 9.54124 * 10^7, which is closer to your goal. If you want to use the formula where … | |
Re: Hint: Write the bar graph out line by line. Draw out a sample by hand and see which values have stars printed on which lines. After you've figured it out using cout, send the output to your ofstream object instead. Give it a try and see how far you can … | |
![]() | Re: Your code is confusing. I'm assuming you assign a value to "a" in code you haven't shown, otherwise you're getting whatever junk is in "a" to begin with. Why not just use rand() to generate a start time, then call it again to generate a random offset from the start … |
Re: Check out [url]http://msdn.microsoft.com/en-us/library/aa904305(VS.71).aspx[/url] to see how to use the Split() method of the string. You will form a string array with each of the different tokens at a separate index. Depending on what data type they are you may need to parse them (see [url]http://msdn.microsoft.com/en-us/library/aa328656(v=VS.71).aspx[/url] for an example). You are … | |
Re: See [url]http://cplusplus.com/reference/clibrary/cmath/pow/[/url] for a reference. Watch out for the overloads that are allowed (i.e., there is no overload for an integer to the power of integer, so you'll need to do appropriate casting). | |
Re: [quote]can explain detail like write down the pseudocode and the whole c++ program.. thanks^^ [/quote] This looks suspiciously like a homework assignment. Please let us know what you have tried first. Working the problem on paper will help you write the pseudocode, etc. | |
Re: What have you tried so far in code? Can you create a project that has 2 (empty) classes in it? | |
Re: If the user inputs 3:00 pm you need to convert that into 15 hours on line 56 so that you can compare it accurately against your seconds up to 11:59 am in line 83. Otherwise you are comparing 3 to 12, which is less than, thereby outputting your AM value. | |
Re: I think a majority of them are interesting but I like the futurist type things (I guess I am an "overall geek" as Nick put it). I'm not as captivated by things about social media. | |
Re: I haven't done a lot with C++/CLI but coming back from C# to the C++ I learned first it has been interesting to play around with this illegitimate child of C++ and .NET. See [URL="http://en.wikipedia.org/wiki/C%2B%2B/CLI#Handles"]this[/URL] for question #2, it's quick but it will get you used to some of the … | |
Re: I get the same restriction. It's too bad because that is a useful link. [quote]jonsca, you do not have permission to access this page. This could be due to one of several reasons: 1. Your user account may not have sufficient privileges to access this page. Are you trying to … | |
Re: Have a look at something like this: [url]http://msdn.microsoft.com/en-us/library/1b4az623.aspx[/url] This is one of those unfortunate cases where the unmanaged and the managed data types cannot be interchanged, you need to marshal the string. | |
Re: It's not too bad: [code] Label^ lbl = gcnew Label(); //fill in the Location property (specify by System::Drawing::Point(x,y)) //fill in the Text property Controls->Add(lbl); [/code] | |
Re: Please don't type in all caps no need to YELL lol. What's the problem with the program? Is it not giving you the result you expect or are there errors? Please be more specific. Please place your code in [noparse][code]//code here[/code][/noparse] (it's not too late to edit your post). | |
Re: Dude, the only thing you are doing is diluting and polluting your argument further (and believe me it wasn't much of anything to begin with). Science is a culture which seeks truth. Coming with membership in that culture is a great degree of responsibility to "play nice," contribute and demand … | |
Re: There are a couple of things that are standing in the way of this compiling. When you posted last I assumed incorrectly that this would be a console application. Upon a closer look it appears to be an MFC (MS Foundation Classes) application which is not directly supported by the … | |
Re: Depending on what system you are using textboxes can be read only or read/write. What are you trying to write this in (Win32 API, MFC, Winforms)? | |
Re: See: [url]http://www.cplusplus.com/reference/clibrary/cstdlib/system/[/url] The function returns an [B]int[/B] that is "system-dependent" (could be an exit code for the program, could be garbage). Perhaps write the output of the program to a textfile (using "samp -s1122 > text.out") and read that into your program. I'm not sure if this is a case … |
The End.