2,898 Posted Topics
Re: This line is the problem: fraction::fraction(1, 10); If I understand correctly, you assumed that this line would construct `sec` with the given parameters (numerator, denominator). However, this is not how you call a constructor, in fact, I don't think the compiler should allow you to do that at all. The … | |
Re: > i need `base* b = /*derived*/d;` done backwards That is exactly what the `static_cast` does. Why do you assume that doing `base* b = d;` makes it so that `b` contains the same address value as `d`. In fact, there is no guarantee that it will. In a single … | |
Re: The easiest is probably to simply keep a variable, call it `totalSales`, to which you add the cost of each ticket that is bought, as they are bought. So, after line 25, you can add: double totalSales = 0.0; Then, right after line 104, you can add this line: totalSales … | |
Re: Well, I looked at spoj, and they do have different versions available for most of the other languages too. For C++, they explicitly say (g++ 4.3.2) and (g++ 4.0.0-8) which are the GCC C++ compiler versions 4.3.2 and 4.0.0. These are both fairly ancient compilers. If you look at GCC … | |
Re: Forum Linguistics 101: > What does **OP** stand for in **OP Kudos:**? (a) Operating Peethan (b) Obnoxious Pre-madonna (c) Overflowing Pie-hole (d) Original Poster Which one of these multiple choices is correct? ![]() | |
Re: Usually, I find that the insertion / deletions are often easier to implement with a local "collect-destroy-rebuild" approach. What this means is that you inspect the local branches around the element to remove or near the place to insert. If you have the wiggle room necessary to simply remove/add the … | |
Re: Use [Qt](http://qt.digia.com/). It meets all the requirements you mentioned. It is fast, easy, allows you to do simple menus and buttons, as well as drawings and pictures, and it works with both Visual Studio and GCC (both MinGW Windows and in Linux, or even Mac). | |
![]() | Re: But as Dani said, if there is someone you want to endorse, you can just go to his/her profile, go to the "Skills Endorsements" tab and clik on the big button to endorse that member. I think that's easy enough, and practical. ![]() |
Re: Where: in the source file (not in the header file). How: like this: // in my_class.h: #include <list> class MyClass { private: static std::list<int> privateList; }; // in my_class.cpp: #include "my_class.h" std::list<int> MyClass::privateList = std::list<int>(); Or with whatever else you want to initialize it with. | |
Re: Let me clarify your question for the less perspicace: You are using Visual Studio 2008, and you are looking to create COM objects (plug-ins) using the Active Template Library (ATL) for C++. Have you tried going through the [tutorials and manuals](http://msdn.microsoft.com/en-us/library/3ax346b7(v=vs.90).aspx) provided on MSDN? Do you have any specific problem? | |
Re: At line 49, you have this: nodeType *head_ptr *newNode; which is missing a comma, to give this: nodeType *head_ptr, *newNode; But, I guess you declare the "newNode" pointer again at line 59 (which is a better place to declare it), so line 49 should probably be: nodeType *head_ptr; That should … | |
Re: > Are you trying to get answers to your own questions? Not really. I think I posted 3-4 threads asking a question. So, that's a negligible amount. > What value do you get from helping people? Many things. A warm fuzzy feeling inside. Discovering different perspectives, different issues and interesting … | |
Re: See [this thread](http://www.daniweb.com/community-center/daniweb-community-feedback/threads/441241/how-experienced-is-the-community). It's a new feature that Dani is rolling out, there's been discussions about it on that thread I linked to. | |
Re: @Rev: That's the official summer sport. Ice Hockey is the official winter sport. | |
Re: C++ is the language of choice in Robotics. C is also needed very often when dealing with drivers or small micro-controllers that don't provide any better option. As far as I know, Assembly is not needed in robotics. But you could encounter some domain-specific languages (DSL) depending on the application, … | |
Re: > she calls the sophmores her pet peeve So your teacher calls her students an annoyance? Sounds a bit self-defeating to me. Living in a busy city where I walk everywhere I go, my pet peeve is all those people who just shouldn't be walking in a busy city. You … | |
Re: Did you make sure the include the header required for the class PdfContentsGraph? Which is: #include "PdfContentsGraph.h" using namespace PoDoFo; // <-- this is needed too, otherwise you have to use it as 'PoDoFo::PdfContentsGraph'. The error message is exactly what you get when you forget to include the right header … | |
Re: You should probably start by making a [Dynamic Array](http://en.wikipedia.org/wiki/Dynamic_array), which is what is implemented in the `std::vector` class. The idea is simple. Instead of increasing the size of the array at every insertion, you keep it always bigger than it needs to be, using a base-2 rule for the size. … | |
Re: You could use setw and setfill functions to avoid that if-statement in your loop. As so: [CODE] #include <iostream> #include <iomanip> #include <windows.h> #include <cstdlib> using namespace std; int main(){ int minutes; int seconds; cin >> minutes >> seconds; seconds = (minutes*60)+seconds; cout << setfill('0') << endl; while(seconds>0){ cout << … | |
Re: ^ Granpa Jim What gets me mad is those lame vocaleses that most R&B singers always feel the need to do. You know, when the singer takes one syllable, stretches it out forever and makes a whole "melody" out of going between high and low pitch while on that same … | |
Re: -- Hint: I fixed your formatting. Errors are easier to spot that way. You should develop the habit of doing so yourself in the future. -- My guess is that error comes from forgetting to put the `default:` statement (or `case 3:`) between line 118 and 119. Basically, if the … | |
Re: Can you explain what Line 13 is supposed to be. The line goes like that: USHORT shape1 = triangle, square, rectangle, circle; What do you expect that line to mean? Because I have no clue. It is definitely not valid C++ code, but I cannot tell you how to fix … | |
Re: There are a number of ways to do this, depending on the features you require. If all you want is a unique account number for each new account that is created, you can control that with a factory function and a static "last" account number being tracked. In that case, … | |
Re: I know that VS 2008 and 2010 can co-exist pretty well. But that's all I can really tell you, I haven't used or installed 2012 yet (and I recently had to do some work with VS 2010, which was extremely frustrating, as usual with VS products, so I'll need a … | |
Re: “Never. Never ask for what ought to be offered.” ― Daniel Woodrell > Would you guys recommend me for a mod for Daniweb???? Be patient my friend. When I became a mod, I had about 4 times your post count, had been around for about 2 years, had about 100 … | |
Re: First, you should split the recursive function into two: the top-level function (that is called from main) and the function that is called recursively. You use the top-level function to make the initial call to the recursive function, and then report the result. As so: void recursiveSwap_impl(char myArrayR[], int left, … | |
Re: >>It is still a lung, but the bullet has stopped it. it is still an infinite loop. just stopped by return 1; I think that you put too much "philosophy" into it. An infinite loop is just a loop that runs forever, and so, your loop is not an infinite … | |
Re: A while back, as part of the newsletters, there was an invitation to write tutorials and the instructions were given more or less as follows: post a normal "Discussion Thread", and then send a PM to the relevant moderators and admins asking to turn it into a "Tutorial", if they … | |
Re: Being a geek and all, here are some command-lines to fix the World's problems: The anarchists would say: $ sudo reboot The conservatives would say: > chkdsk /r The progressives would say: $ sudo apt-get update The neo-cons would say: $ srm -R any_country@middle.east:/* Christian fundamentalists would say: > FORMAT … | |
Re: First hit on google: [makefile tutorial](http://mrbook.org/tutorials/make/). Do you have any specific question? Remember that makefiles are space-tab sensitive (a very annoying aspect of makefile syntax), meaning that the number of spaces and tabs (and where tabs appear rather than spaces) is important. Frankly, writing makefiles directly by hand is out-right … | |
Re: > build-esential was already installed. I reinstalled it but still not work. Make sure that you purge it before reinstalling: $ sudo apt-get remove --purge build-essential $ sudo apt-get install build-essential Other than that, your problem is a real mystery to me. You might have a better chance on a … | |
Re: There are plenty of options, from the most basic to more sophisticated setups. As a beginner, you will want something down the middle, like a simple program that you can install and it will allow you to code small applications and hit a "play" button to compile-and-run your code. What … | |
Re: Happy birthday Dani! I haven't tested my typing speed for a long time (the last time I was probably in highshool). Took your test, I scored at a rather unimpressive 50 WPM. I think having to read off what I need to write next throws me off a bit (I'm … | |
![]() | Re: To sooth me down after a bad day, usually anything from "The Doors", "Bob Marley", "Scandinavian Music Group", or "Metallica" is all I need. "Rammstein" is also pretty soothing. |
Re: Just for fun, I cooked up a little algorithm of my own, without going as far as getting into bit operation-style algorithms. So, in a few minutes or so I got this algorithm which I think is fairly elegant and short: [CODE] void genPrimeNumbers(int n) { vector< pair<int,int> > accum; … | |
Re: It might help you to know that "sorting using priority queue" is pretty much a synonym for an algorithm called [Heap Sort](http://en.wikipedia.org/wiki/Heapsort). A priority queue is almost invariably implemented as a heap data structure. And once you have the elements arranged in a [heap structure](http://en.wikipedia.org/wiki/Heap_(data_structure)), it is a simple matter … | |
Re: > I understand that iostream.h is outdated and Microsoft Visual Studio has iostream. The headers like `<iostream.h>` are pre-standard (from before C++ was standardized), so it dates back to the 90s or earlier. Most compilers probably still support it for legacy reasons, but they don't have to, and some don't. … | |
Re: As nmaillet said, pick a [sorting algorithm](http://en.wikipedia.org/wiki/Sorting_algorithm) and try to implement it. The wiki page has a pretty complete list. You should probably start with one of the simpler methods (the O(n^2) algorithms) like [Bubble Sort](http://en.wikipedia.org/wiki/Bubble_sort), [Insertion Sort](http://en.wikipedia.org/wiki/Insertion_sort), or [Selection Sort](http://en.wikipedia.org/wiki/Selection_sort). As for reproducing the behavior of the standard sort … | |
Re: > how do you make your cool or stress free in exams days ? Humm.. this might sound boring but... How about being well prepared? For the most part, I made sure to sustain a genuine interest in the course material during the term (which just requires an open mind … | |
Re: What you can do is add an additional parameter to the printing functions, one that takes an output stream by reference (`ostream&`). And you can also make `cout` the default stream, as so: void print_height (players_rec players[], int howmany, int when_ft, int when_inch, ostream& dest = cout); void print_year (players_rec … | |
Re: If you are under a Unix/Linux environment, this is exactly what [pipelines](http://en.wikipedia.org/wiki/Pipeline_(Unix)) are for, and it is exactly what they do. In Windows, there is [this "equivalent"](http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx) (not really equivalent because it is an extremely convoluted and annoyingly verbose alternative, but it technically does the same thing). Otherwise, a good … | |
Re: There are a few different issues at play here. The basic guideline of "don't duplicate code" is mostly a consequence (or corollary) of the fact that more code equals more opportunities for bugs. And even purely copy-pasted code is still subject to that problem, especially if you factor in a … | |
Re: If under Linux, you can use the "pdftotext" command (from package "poppler-utils"). Then, you can use "libtranslate-bin" package to install a text translator program and use it with "translate-bin" command. So, your problem can be entirely solved by: [CODE] $ pdftotext my_file.pdf my_file.txt $ translate-bin -s google -f en -t … | |
Re: See [this C++ FAQLite entry](http://www.parashift.com/c++-faq/templates-defn-vs-decl.html). Long story short, the definition (implementation) of all templates must be visible in all translation units that use it. Best way to achieve that is to put it in the header file. You can still separate the declaration and definition (but still both in the … | |
Re: Currently, MinGW has version 4.7.0. There is also the [TDM-GCC distribution](http://tdm-gcc.tdragon.net/), which is a bit more up-stream at version 4.7.1. As far as I know, there are not too many differences between 4.7.0 to 4.7.2, so you'd probably be ok with either ones. This is probably easier to live with … | |
Re: That makes no sense to me. First, utilizing the outer product doesn't make the inner loops disappear, it simply masks them inside a function (or product operation), but they still occur just the same. Second, it would be difficult to implement this outer product mechanism without losing some performance of … | |
Re: Refer to the PoDoFo mailing list archive. Specifically, [this thread](http://sourceforge.net/mailarchive/forum.php?thread_name=BLU157-ds114B45D1CA3DC934BF77C3E1CB0%40phx.gbl&forum_name=podofo-users) which talks about your exact problem. For specific problems about building PoDoFo, they are probably better equipped to help you. I actually just checked out the source for PoDoFo and built the library. There were a few annoying hurdles, and … | |
Re: Open the top-level "CMakeLists.txt" file. Find the line with the command `INCLUDE_DIRECTORIES`. And add to that list whatever additional directories required to find those header files, between quotation marks. | |
![]() | Re: > What is the purpose of static member functions in a class? Well, others have already pointed out one kind of purpose for static member functions. But there are many others too. In other words, there are many "tricks" that rely on a static member function(s). So, it's pretty hard … |
Re: Yeah, good luck to our NY daniwebbers! Even north of the border, safe in my apartment thirteen floors up above downtown Montreal, the winds are whistling really strong. As long as the Daniweb servers don't get blacked out, the world won't come to an end. ;) ![]() |
The End.