2,898 Posted Topics
Re: the function `stoi` does not exist. The function you probably meant to use is `atoi`. And you need to include the `<cstdlib>` for that one. | |
Re: If you want to play youtube videos in the browser, you need to [install flash-plugin](http://fedoraproject.org/wiki/Flash). To download youtube videos, you can use the `youtube-dl` program. As so: $ sudo yum install youtube-dl which is a command-line program to download youtube videos. [See docs here](http://rg3.github.io/youtube-dl/documentation.html). | |
Re: I just replied. I initially thought that nullptr would come back around to answer. > **why** I do not get answer to my question??? That can vary. Sometimes the post is just too long. Sometimes you don't get the feeling that the original poster is really pull his weight (not … | |
Re: You should call the constructor of Date in your initialization list, and you can pass it the three integers you get in the Person constructor: Person(const char * their_name, const char * email, int aDay, int aMonth, int aYear) : Date(aDay, aMonth, aYear), name(0), email_address(0) { name = new char[strlen(their_name) … | |
Re: This forum uses English only. Please restate your question in English. It is against the rules to post in another language, so this is a warning. | |
Re: You have a typo on line 78, in your constructor, you have `setz(yin);` when it should be `setz(zin);`. | |
Re: Do you know [calculus](http://www.math.hmc.edu/calculus/tutorials/odes/)? If you have a first-order differential equation like this: dN/dt = -l * N(t) You get the following analytical solution: N(t) = N(t0) * exp(-l*t) Here's how you get it: 1) Separate the variables: dN / N(t) = -l * dt 2) Take the integral of … | |
Re: My guess is that if you try to compile this with a C++ compiler, it will work just fine. So, why do you need to convert it further? (btw, I have my suspicions, I'm no fool) In any case, you need to show that you tried something. We will not … | |
Re: The `FILE*` way of reading from a file is just the legacy that was inherited from C. The C++ language was developed with the aim of largely keeping compatibility with C (i.e., C is nearly a subset of C++, with only minor incompatibilities). This means that the entire C standard … | |
Re: Can you clarify what you mean by "violating the DMCA"? Can you provide some examples of search hits that direct to such "violations"? I really don't understand exactly what you are referring to. And also, the internet is full of "questionable" content, so I would expect that any decent and … | |
Re: First of all, from your algorithm, it seems that the array is sorted from greatest value to lowest value, right? Otherwise your `if(array[middle] > value)` has the wrong `<` / `>` sign. What seems bizarre with your binary-search algorithm is that it doesn't seem to allow for or detect the … | |
Re: Yeah, I had noticed that a while back. Me and some others have talked about it on the initial "bug thread" for the new interface. I guess this may be a forgotten item on Dani's todo list. Thanks for the reminder. | |
Re: Think of it this way. The steps you need to perform are as follows: 1) Copy the sequence. 2) Iterate through the sequence: 2-1) Replace the element value `x` by `f(x)`. 3) Return the modified sequence. The first step is already done, because the sequence `c` is passed by value, … | |
Re: Why do you want to install a windows program onto Linux? Chances are, there is a Linux version of the software or an equivalent application for Linux. What is the software itself? Maybe we can suggest a Linux equivalent. | |
Re: Go in the bios menu, and disable the "secure boot". It is a Microsoft-controlled "feature" to boot only "approved" operating systems, in other words, it's to prevent you from not using the Windows installation that came with the computer. The good news is, you can disable it, it's required by … | |
Re: There was a similar thread not too long ago. You might want to give it a read: [Need help with university scheduling using Genetic Algorithm](http://www.daniweb.com/software-development/computer-science/threads/461962/need-help-with-university-scheduling-using-genetic-algorithm) I can't really say much more than what I explained in that thread. And, of course, I agree with gusano79, the tricky part is coming … | |
Re: > How to evaluate that the timetable is the most effective. Any idea? Well, you described your problem as a "smart scheduler". So, you must have some idea of the difference between a schedule produced by a stupid scheduler and one produced by a smart one. But, to create a … | |
Re: [This](http://www.cplusplus.com/reference/iterator/ostream_iterator/) should give you a pretty good hint. | |
Re: > How many use it on Linux I've never used it. I keep Windows around on a dual-boot. And the only things that I cannot get in Linux are things I wouldn't try to run in Wine, or not worth the effort. Mostly, I use Windows for either computer games … | |
Re: The search algorithm is pretty trivial, that's why you always get back to the "Binary Search Tree". Once you have a binary search tree constructed, searching for a particular element or range is a simple matter of recursively going down the branch which should contain the sought-after value depending on … | |
Re: "Who can solve this algorithm?" Hmmm... **you** maybe? Usually, when you get an assignment to do, it is because it is something that **you** could benefit from doing **yourself**. We don't provide ready-made answers to assignment questions here, because it helps no-one to do so. And, we aren't tricked that … | |
Re: > using methods which would be difficult (though perhaps not impossible) in C++. .... > This specific approach won't work in C++, as it relies on the ability to generate new functions programmatically. Is that some kind of a joke? Or maybe you're taunting me? The code you posted is … | |
Re: I think it's just a matter of you having fairly low counts and that you've had quite a bit of activity in the past week or so (lots of posts, and several "post comments" with reputation points associated). This can make your rank jump quite a lot. It's all relative. … | |
Re: Well, `125 / 10 = 12`, because this is using integer arithmetic. So, because the type of `x` is `int` (i.e., cannot represent floating-point numbers), then, the meaning of `x / 10` is that the value of `x` is divided by 10, but the remainder is discarded. The remainder is … | |
Re: The same is true for line 32. Both loops are infinite do-nothing loops. I'm not sure what you tried to do, I can't really understand what's going on. | |
Re: I guess I'll just share a few of my own eclectic obsessions too: [Frankie Yankovic](http://www.youtube.com/watch?v=RN_VwMb8m2M) ("America's Polka King") [Manu Chao](http://www.youtube.com/watch?v=vJMLJVha5sw) [Scandinavian Music Group](http://www.youtube.com/watch?v=AMnqTTCGmdI) (it's in Finnish) [Radio Radio](http://www.youtube.com/watch?v=IqfSoDG1C3g) (the language is [Chiac](http://en.wikipedia.org/wiki/Chiac), if you're wondering) [Gnarls Barkley](http://www.youtube.com/watch?v=u_R9fId_Rqo) Carolina Chocolate Drops ([Jig](http://www.youtube.com/watch?v=nliiRDmBbEQ) or [Folk](http://www.youtube.com/watch?v=gk62UAM7Hpk)) A few French-canadian stuff too (I have … | |
Re: The problem is coming from the fact that you delete the `terrain` pointer in the destructor, but that pointer points nowhere, i.e., you have not created an object to which it points to using the `new` operator. You can only call `delete` on pointers that point to memory allocated with … | |
Re: Just a crazy thought. Why not just enforce international law? Arrest Asad and his high command for war crimes, and put them on trial. Maybe I'm crazy, but I think that could be the best course of action. | |
Re: First thing's first, did you notice the update on the instruction website: quote: **Update 2**: the installer now requires you accept the Oracle license **before** the installation begins. This is only required once. If for some reason you need the installation to be automated, you can run the following command … ![]() | |
Re: I guess modern is relative, if you are used to using `vi`, `vim` or `emacs` for all your coding needs (as many many people do), then, in comparison, sublime-text looks like an ultra-futuristic spaceship (not Xenu's spaceship that "looks exactly like a DC-8"). I tend to prefer when applications stick … | |
Re: Let me get this straight. You want to demodulate IF signals digitally from a Windows PC? Isn't this sort of insane? IF signals are usually around 20 to 100 MHz in frequency, depending on application, meaning that your analog-digital converter would have to run at about an order of magnitude … | |
Re: why not a little [?] thing that you can click for a tooltip description | |
Re: This looks suspicious: > 1.5 million new lines of COBOL code are written every day > 5 billion lines of new COBOL code are developed every year If I know math correctly, I would say that 1.5 million times 365 days is only about 550 million, i.e., about 10 times … | |
Re: First of all, it is far simpler than it looks. The first thing I will point out is that if you need a local copy of the string, then you should take that string by value (instead of const-reference), it is preferrable in general to do so, and it also … | |
Re: I have a number of tutorials that are partially complete, as I've had trouble finding the time to complete them. But now, I've started to teach tutorials on C++ at my university, so, I must "produce" now. So, you'll probably see a few tutorials from me soon. ;) | |
Re: It is not because the debugger tells you that the error is at that line that it necessarily is exactly that line which causes the problem. What is the broader context of that line? Could it be within a member function of a class? Maybe the function is called on … | |
Re: > but in these case i belive that i can't use the 'const':( That's right, you can't use a constant because `std::endl` is actually a free-function which gets implicitely converted to a function pointer, and then, within the stream's `<<` operator, it is called on the stream. Anyways, long story … | |
Re: I haven't used DVD-rippers in a while. But a few years back, before I temporarily moved to Europe, I had a bunch of DVDs, bought in Canada. I could have brought them all with me (as a disk stack), but even then, I could not watch them, since my only … | |
Re: Just use [Boost.Asio](http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/tutorial.html) (C++). Or, just use the POSIX functions in C / C++. It's not hard to do some UDP communication, a few lines of code, no more, and it's very intuitive. [See this tutorial](http://www.linuxhowtos.org/C_C++/socket.htm). | |
Re: I tend to go for the `stringstream` class instead, because it is more "C++-style" and it has more options in terms of formatted input. For a simple string-to-int mechanism, I would just do: std::stringstream(MovieRecord->getMinutes()) >> totalMins; Or, in two steps: std::stringstream ss(MovieRecord->getMinutes()); ss >> totalMins; This is also nice because … | |
Re: You should also remove the `using namespace std;` from your header files. [It is not acceptable to have using statements in header files](http://www.lonecpluspluscoder.com/2012/09/i-dont-want-to-see-another-using-namespace-xxx-in-a-header-file-ever-again/). This is a rule to which there are no exceptions, period. You need to use `std::` for each standard library component you use in your headers. | |
Re: Where is your implementation of the constructor of Array, specifically the constructor that takes one argument? The compiler is telling you it cannot find it, neither can I from the code you showed. Your NumericArray constructor requires the definition of the Array constructor, which is missing, apparently. | |
Re: I'm afraid your question is too unclear. Please give an example of what you would like to achieve. | |
Re: The reality is that there are limits to what you can achieve using the combination of implicit conversion operator and the assignment operator. You will not be able to make the "property" look like the actual value (i.e., make a property variable look like a normal variable but have hidden … | |
Re: If I have a number like `13`, its binary representation is `1101` (i.e., `13 = 8 + 4 + 1 = 1 * 2^3 + 1 * 2^2 + 0 * 2^1 + 1 * 2^0`). If I do a bitshift of the number to the left by one bit, … | |
Re: > is there a possibility to write such a common compiler? Most compilers out there are written as a front-end and back-end duo. The front-end takes care of parsing the language, applying syntax rules and converting all the code into a simpler kind of code (usually something close to the … | |
Re: It seems to me that Qt has pretty much "won" at this point. Occasionally, people will mention that wxWidget is a bit more light-weight or something like that, but for the most part, it seems that cross-platform GUI development is dominated by Qt now. | |
Re: For the compiler to be able to inline a function, it must see its definition (implementation). This means you cannot do the classic "declaration in header" / "definition in cpp file" paradigm. The definition must be in the header file. Marking the function as `inline` or `__forceinline` tells the compiler … | |
Re: If you cannot use the C++11 swap functions, your best bet is probably to use the filebufs directly and construct vanilla `istream` / `ostream` objects from them. Something like this: class my_ofstream : public std::ostream { private: std::string filename; std::filebuf* pfb; public: my_ofstream(const std::string& aFilename) : std::ostream( new std::filebuf(aFilename.c_str()) ), … | |
Re: You cannot peek for more than one character. However, you can use the `tellg` and `seekg` functions to restore the original position after having done a multi-character reading. As so: int peek_int(std::istream& in) { std::streampos orig_pos = in.tellg(); int result = 0; in >> result; in.seekg(orig_pos); return result; }; |
The End.