- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 56
- Posts with Upvotes
- 43
- Upvoting Members
- 23
- Downvotes Received
- 6
- Posts with Downvotes
- 3
- Downvoting Members
- 4
159 Posted Topics
Re: And what keeps you from going to the site directly? | |
Re: If there are three logic bugs in total and one's down, two are left. | |
Re: Why is it prohibited to buy a C++ book where you live? In any case, there is a fairly good book available online for free (Thinking in C++): [url]http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html[/url] | |
Re: [QUOTE]The null chars are being converted to full stops.[/QUOTE] Somehow I doubt that. Are you sure that it's not just the way the packets sniffer displays the data? It is quite common to display unprintable bytes as '.'. | |
Re: There might be more experts than you'd think. On another forum, there is an user who essentially knows the C++ standard by heart. And as far as I know, he is neither part of the C++ standard committee nor is he working for a C++ compiler vendor. I would expect … | |
Re: The basic idea is that you combine your bit sets until you have 8 bits you can write to the file. In semi-pseudo code: [CODE]uint bitsUsed=0; uint64_t combinedSet=0; [...] const uint64_t bitSetToAdd=1234; const uint bitSetLength=12; combinedSet|=bitSetToAdd<<bitsUsed; bitsUsed+=bitSetLength; while (bitsUsed>=8) { writeByteToFile(combinedSet&255); bitsUsed-=8; combinedSet>>=8; }[/CODE] Don't forget to "flush" any remaining … | |
Re: I must say that I'm surprised that this happens. I know that memory management doesn't always return the pages to the OS immediately, but it seems that even if you create and delete 1 GB+ worth of objects, the memory is not returned to the OS, even after some time … | |
Re: I'd like to point out that the OP is a troll who is just repeating the same procedure that he already went through on other forums using various names. He's just testing how far he can push people before he finally gets banned. If you look at his other threads, … | |
Re: You give them every last detail of gameplay and the design of the interface. They'll need to know what your game world can contain, how the player can interact with it and any characters in it (such as talking, fighting). Each topic requires you to go more in-depth, so if … | |
Re: As far as I'm concerned, your code has a much more serious issue... the following: [CODE] if (pixel[0] == 255) { if (pixel[1] == 255) { if (pixel[2] == 255) { return false; } else { return true; } } else { return true; } } else { return true; … | |
Re: Why the unnecessary restrictions? Besides the linked list, you won't get around using all of these anyway and using a linked list should depend on whether a particular implementation you had in mind actually needs it. Aside from that, it's not really that much of a challenge and especially not … | |
Re: Counter-question: why can you watch YouTube videos without any problems even though you do not have a 210 mbps connection? The answer is the same in both cases. | |
Re: [CODE]string playerName[SIZE]; int score[SIZE];[/CODE] You also should look up vectors. The above both incurs an unnecessary limitation on the number of objects you can have and in most cases, it just creates lots of instances that are never actually used. | |
Re: @Nandomo You still allocate the int variables dynamically, for which there is no reason. If you find yourself writing the keyword new, you generally should stop and try to find good reasons why you [i]need[/i] to use new. If you can't, you shouldn't use it. Doubly so when you find … | |
Re: Dev-C++ is outdated, you should use a different IDE (such as Code::Blocks). As for graphical libraries, SFML would be your best bet (assuming you're talking about 2D graphics). SDL is also popular, however it is a C library (of course, you can still use C libraries with C++ if you … | |
Re: This assignment sounds very familiar... anyway, why do you think you need to change the function? std::string overloads operators <, == and >, so it should work without any changes. Do you have to implement the sorting algorithm yourself? If not, a [code]sort(name,name+SIZE);[/code] does the trick (needs the header algorithm). | |
Re: The easiest way to do this is to write a program that takes a problem as the input and gives the source code of the solution... then you can use it to solve this problem. Seriously though, what kind of algorithm? Don't say "any"! | |
Re: [QUOTE=Supriyo;1262305]Can a standalone programmer design large scale C++ projects?[/QUOTE] In theory, if said programmer is very experienced. However, experience does not come by learning "good coding style rules" by heart. | |
Re: [ICODE]return 0;[/ICODE] might be a good idea, no? That requires you to fix the return type of function, though. And you need to fix the the return type of main too, because it always must be int anyway. | |
Re: [QUOTE=;][/QUOTE] Also, please use std::string and std::swap - this is the C++ forum after all. | |
Re: [QUOTE=;][/QUOTE] This page has what you need to know about ar archives: [url]http://en.wikipedia.org/wiki/Ar_%28Unix%29[/url] Start by extracting the three files from the .deb. Then you can proceed with the important part, i.e. extracting the desired file(s) from the data archive. | |
Re: This form of compression is called run-length encoding. However, it performs quite poorly for most types of data. Instead, you should look if any substrings already occurred earlier in the text and save a offset/size pair if they have. This is the general idea many popular compression algorithms are based … | |
Re: The relevant part of the C standard is in 5.1.2.2.1: [QUOTE]The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int [/QUOTE] C does not have inheritance, so obviously there is no dynamic_cast either. … | |
Re: It should be: [CODE]if(beginMinute + durationMinute >= 60)++endHour, endMinute = (beginMinute + durationMinute)%60; [/CODE] | |
Re: You're meant to only access the top element of a stack, so std::stack provides no way to iterate over its elements. But you could keep removing elements from the stack until you find the value you're looking for or the stack is empty, then push all elements back on the … | |
Re: You definitely need to rethink your usage of classes - that's not how they were meant to be used. They are supposed to represent (conceptual) object classes and thus the instances should represent certain objects. But: what is a "dead"? And what is an "alive"? | |
Re: There is no difference, except that you connect to the remote IP address instead of your own. | |
Re: The error message says it all. ApplyRoll expects seven arguments, but you're just passing one. | |
Re: This should be in Hardware Software/Linux and Unix/Getting Started. Most Windows programs run fine when you have Wine installed. However, some show problems that are not present when running on Windows and some don't work at all. See the Wine AppDB entry for your software (assuming it's what you mean): … | |
Re: erf and erfc were added to C with the C99 standard, but Visual C++ still doesn't support it. I suggest you install boost if you don't want to switch compilers. Boost.Math provides an implementation of erf and erfc: [url]http://www.boost.org/doc/libs/1_43_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_erf/error_function.html[/url] | |
Re: Looks okay at first glance, except for a few issues: 1. No const-correctness. Member functions that do not change the object (size, empty) should be const. 2. new does not return a null pointer when there is no more memory - it throws an exception of type std::bad_alloc. 3. What's … | |
Re: Perhaps you should explain the sorting algorithm you had in mind, because it isn't really obvious. In the meantime, I have lots of comments about the code: Line 7-9: Make sure to use descriptive variable names. A proper name for "a" could be arraySize or numberCount. b and temp aren't … | |
Re: Calling main results in undefined behaviour, so not really. | |
Re: You'll have to test every possible subrectangle, however you can start at the top-left and keep going left, so you can subtract the most left column of the subrectangle and add the new column each step. When you're done with the row, start with the next one. | |
Re: You can't just listen on a foreign IP address - the address must be one of your own network addresses, i.e. one that your computer is connected to the network with. If you use say, an address of a Google server, it won't do you much good: the internet routers … | |
Re: [QUOTE]or do I have to, in this kind of situation? Does the function free the memory automatically when the return statement is met?[/QUOTE] No delete - no deletion. It would be pretty bad if the memory was freed anyway - then you'd return a pointer to a destroyed object. But … | |
Re: You just had a taste of the joys of floating point inaccuracy. The reason is that although side3 and side1+side2 are mathematically equal for the given points, slight inaccuracies that invariably happen during calculations with floating point types can cause that they end up slightly different, such as 10.816653826391968707 for … | |
Re: This is far and well beyond your abilities. But if you're willing to learn, you can start here: [url]http://wiki.osdev.org/Main_Page[/url] | |
Re: You can use a library such as mysql++: [url]http://tangentsoft.net/mysql++/[/url] | |
Re: .c files are generally passed to the C compiler. Are you sure those files really contain C++ source code? | |
Re: No, it's not okay. If the author manages to include six mistakes in such a short code example (assuming this is from the book and is not part of a "find the errors" exercise), then you need to get rid of the book ASAP. If you don't want to spend … | |
Re: You can't, because new can work very differently from malloc and have its own memory management scheme. You can only pass pointers that were returned by malloc to free - those returned by new probably were never returned by malloc. Interchanging free/delete and new/malloc might seem to work in some … | |
Re: Yes, there's an error in your code. | |
Re: I'm sure it has. You're having an out-of-bounds array access somewhere. Have you run this with valgrind yet? It can discover invalid memory accesses in some cases. | |
Re: To read in a file, you can use ifstream: [CODE] ifstream file("filename",ios::binary|ios::ate); if (!file.is_open())return 1; /*failed to open file*/ const int fsize=file.tellg(); file.seekg(0); unsigned char buffer[2000]; file.read((char*)buffer,fsize); if (file.fail())return 1; /*failed to read file*/[/CODE] To convert the strings into numbers, you can use stringstream or just use ifstream directly (then … |
The End.