1,684 Posted Topics
Re: Learn Scheme, C++, Haskell, and C#. That will take some time. You have to actually do projects in them, of course. The languages you've listed, and most other languages, are not worth learning if you have those four and are interested in generally improving your coding ability, but they may … | |
Re: 3 and 2 are integers (in C++, they have the 'int' type), so the division sign in [icode]3/2[/icode] refers to integer division, which produces an int return value, which must be truncated. If you write 3.0/2 or 3/2.0, one of the values will be a double, thus forcing the other … | |
Re: A way to make this really easy is to get the GMP library (it comes with C++ bindings, right?) and use that. It's silly to output the number to a file and then read the file back in. Since you don't have enough precision in the built in numerical types, … | |
Re: That macro is fucking retarded. Use a function. | |
Re: You shouldn't think about the average pay level, you should think about what [i]you'll[/i] be paid. | |
Re: The dot product of two vectors is equal to the cosine of the angle between them divided by the vectors' magnitudes. For example: The dot product of <1, 2> and <3, 4> is 1*3 + 2*4, i.e. 11. The magnitudes of the vectors are sqrt(1*1+2*2) and sqrt(3*3+4*4), i.e. sqrt(5) and … | |
Re: You can't use commas that way. You want to write [icode]again == 'Y' || again == 'y'[/icode]. The comma operator behaves in the following way. The left side of the comma operator is evaluated first, and then the right side is evaluated, and the expression's return value will be the … | |
Re: Actually it's impossible, if you're using integers, because the size of the solution is n*log_2(x) + O(1). | |
| |
Re: [quote]F(N) = O(G(N)) reads that F of N is Big O of G of N[/quote] That's not a "solid definition", that's a description of how you read the notation out loud. [quote]F(N) = O(G(N)) if there exist two constants c and k such that F(N) <= cG(N) for all n … | |
Re: Sort them by the kind of terms they have, and then group the similar terms together. Alternately, don't use letters at all in your representation of polynomials -- but this only works if you limit yourself to polynomials of a single variable. | |
| |
Re: If you want to know what the algorithm is, read the whole paper. | |
| |
Re: I'm pretty sure you want something that works like the following: [code](transform '(+ - + - / + - + - + + + / + + + - - - / + + + - - - - +))[/code] It would make no sense to make transform into a … | |
Re: [code] void getline(char* line) { int n=0; while((line[n]=getchar()) != '\n') { n++; } line[n]=0; } [/code] You shouldn't use broken code examples. [code] parse ws [ anychar[] Wo anyindex an -> Wo Wo[ Wo[an]==' ' || Wo[an]=='\t' || Wo[an]=='\n' ] [ return true; ] ] [/code] This is _extremely_ verbose … | |
Re: So, in simple terms, what is extreme programming all about? | |
Re: Lex and yacc are obsolete (because they use C); use something more like ANTLR... for parsing. But this is just in reply to ithelp's post, obviously it has nothing to do with your problem. | |
Re: This code only works on one column, that's why you see the radix function called four times. And it's not working on the ones, tens, hundreds columns, it's working on the first, second, third, and fourth bytes. 0xff is the number 255, and & does a bitwise 'and' operation. Look … | |
Re: [QUOTE=Ancient Dragon;741846]Why not put your music degree to work in the IT field. I should think you could get a job at one of the big game houses providing and/or writing music for the games.[/QUOTE] It's probably quite hard to get a job like that. And the idea that such … | |
Re: If you're going to make a blog, why would you make one on Daniweb, as opposed to some other blogsite or your own site? There is no reason for people to do this. I would focus more towards tutorials done in a wiki-like fashion. | |
Re: You can figure out your first problem just by looking at your results. You're not printing the last 1 of each row. Why? Well, you're stopping too early in your loop that prints out the row's numbers. For your second problem, if you temporarily added a few cout statements that … | |
Re: Dynamic typing vs. crappy static typing vs. good static typing; concurrency. | |
![]() | Re: [QUOTE=skatamatic;743643]ummm....lol. What a rediculous objective. Is this to be console based? No graphics whatsoever? If it is console based, I'd say that the contest is much too easy and find it hard to believe that an award is really being offered.[/QUOTE] Then why don't you cry about it? Oh wait, … ![]() |
Re: You haven't told us how many words each of the two files have. | |
Re: message_to_network should already be a function that waits for a new message to reach the socket. I'm guessing about its implementation, but you should just need to call that function -- it will return as soon as the message arrives, or when the connection times out. Obviously, it makes no … | |
Re: Who are these people who've put you through such a ridiculous assignment? Off with their heads! You should be writing code! | |
Re: This is the stupidest use of operator++ I've ever seen. | |
Re: Yes. One easy way is to use two maps, one map<int, double*> and one map<double*, int>. You need to make sure that you only have one index per color, though. If you want to be able to have a color appearing at multiple indices, use a multimap<double*, int> instead of … | |
Re: [code]int getUnique() { static int n = 0; return ++n; }[/code] This function is not multithreading safe. | |
Re: Not unless you explain what "H" or "HD" or "WSO" or "[;g(n-1)]" are supposed to me. | |
Re: You can use the Distinct extension method. [code]public string[] GetUniqueStrings(string[] input) { return input.Distinct().ToArray(); }[/code] You can do the same for a [icode]List<string>[/icode], only use [icode]ToList()[/icode] instead of [icode]ToArray()[/icode]. | |
Re: Initialize the salary at 1 and, each time through some look that runs 'days' times, double it. Or you could just use [icode]1 << (n - 1)[/icode] to compute the amount paid on the nth day, or [icode](1 << n) - 1[/icode] will give you the cumulative amount paid after … | |
Re: Your second method is broken -- you forgot isdigit. Your third method is not radical. Negative values will fail when a lookup table is used to implement the function -- they point in memory outside the lookup table. | |
Re: I have never heard of "SAP," other than as the name of a company whose U.S. headquarters are in Newtown Square, PA, so I would just ignore whatever punjabivirsa3 is trying to say. | |
Re: csc is not in your path. Add the directory in which csc lives to your PATH environment variable. | |
Re: Ya think? Looking at your code, how could you expect it to do anything different? I don't see any attempt to maintain a board's state, and your program does not even deserve to be called an attempt at a checkers program; except upon the rare click, it just calls GamePaint … | |
Re: People here get really grumpy when folks ask about final project ideas, because it happens so often. | |
| |
Re: No no no no no don't do that, then you have no hope of disabling RTTI :D. There are other, more serious downsides, like the fact that if you ever change your code to include another subclass, all your code that uses typeid becomes broken. There is something known as … | |
Re: Get a better compiler. And post a real code example. | |
Re: [quote]I would like to compute the main() alone of the file.[/quote] It's hard to understand what you mean, due to your difficulties with English. Could you try rewording this sentence? That might make your desire more clear. |
The End.