2,898 Posted Topics
Re: First part is simple, my name is mike. The second part is an enigma for you guys. 2000 taken to the power 17 is about the total mass of the observable universe measured in grams. No, actually 2000 bitshifted 17 times writes `FA00000` in hex which is cool. I'm kidding, … | |
Re: Here are some "safer" alternatives: 1) use the namespace only within a function body: #include <iostream> int main() { using namespace std; cout << "Blah, blah, blah"; return 0; } This limits the scope of the namespace usage, reducing the scope at which names could clash. 2) use the individual … | |
Re: Wow, LazyFoo seems to be quite an idiot when it comes to licensing issues. So, he basically says: 1) Closed-source, commercial or not: OK to use his code. 2) Open-source, commercial: OK to use his code (with credits given). 3) Open-source, free: Not ok to use his code. 4) Tutorial … | |
Re: It's my impression that viruses are not nearly as much of a problem as they used to be. Maybe it's because anti-virus software have "won" the fight. I think it also has to do with the history of it all. In the early days of PCs (win95 - winXP), a … | |
Re: You should notice this line: Line 3 Right: The total is 10123607318 That is one **big** number. In fact, it is larger than what you can represent with a 32bit integer type, which is what `int` is in Java (the number is about 10 billion, and the max for an … | |
Re: As I gave you the method to walk along the solution path on the other thread, here is the complete code (also removed some unnecessary junk, it is generally not a good idea to put together random pieces of code, you have to understand what you are doing): #include <iostream> … | |
Re: What code do you have so far? We don't just do people's homeworks, you have to show that your are trying to solve the problem, and ask about specific problems that you are having with your code. ![]() | |
Re: To input all the vertices, you should do it in two steps. First, you input the entire line into a string (using `std::getline`). Then, you put that string into a `std::stringstream` and you input each individual name using `std::getline` with the delimiter as `','` character. Like this: std::string temp_str; std::getline(std::cin, … | |
Re: Knowing how the Dijkstra algorithm operates, I would assume that your "Compare" function relies on a "distance" values associated to the nodes, and that these distance values change during the iterations of the algorithm. As the distance values change, the priority-queue (which is just a "heap") becomes corrupt, or out … | |
Re: **Please use English in this forum.** (Du bist glücklich dass ich Deutsch verstehen kann) All seems correct. However, because your KalmanFilter.cpp file is a C++ file, and most other source files (especially Car.c) are C files, it might just be a problem with name-mangling. Your C files expect a C … | |
I'm wondering if it is possible at all to disable the CTRL-S action when writing stuff on the editor. This is just because I am a frenetic hitter of the CTRL-S key combination, which comes from years of just writing lots of stuff (code or text) and constantly hitting that … | |
Re: Your problem is a linking problem. To use openGL you must not just include the header files, but also link to the OpenGL libraries. If your installation managed to find the OpenGL headers (as it did, since it compiled correctly, just didn't link correctly), then it almost certainly means that … | |
Re: The typical way to solve the "reset" and "store path" problem for a shortest-path algorithm on a graph is that you do indeed store a "cost" in each node, but you also store a "predecessor" ID in each node. The "predecessor" acts as a back-tracing record of the optimal path. … | |
Re: The error in your code is that in lines 46 to 50, you redeclare a new set of variables (gross, state, federal...) which are **local to the inside of the while loop**. The while loop condition, however, is outside of that scope, meaning that it is referring to the variables … | |
Re: > "country of citizenship" was the term I couldn't grasp! I don't know what the legal team will say, but I don't think that the country of citizenship really matters in this case. I think that the country in which the material is produced (where the photo-shoot happens) and where … | |
Re: Overloading (of function or operators) is done only with the parameters, not the return type. If you have two function with the same name (or operator), same parameters and a different return type, the compiler is going to say that the call is ambiguous (it cannot choose between the two … | |
Re: You made a typo on line 61: glBindBuffer(GL_ARRAY_BUFFER, vertexId); It should be: glBindBuffer(GL_ARRAY_BUFFER, colorId); Also, I think you should be using `GL_TRIANGLE_STRIP` instead of `GL_TRIANGLES`. See [explanation](http://en.wikipedia.org/wiki/Triangle_strip) or [this page](http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/primitive-assembly/). You simply cannot have 8 vertices representing triangles (2 triangles = 6 points, 3 triangles = 9 points). You might … | |
Re: > Is It possible to work with GUI(Graphical User Interface) in C++? Certainly. It's all pretty much dead on the "Microsoft" side of things (Win32 and MFC are pretty much deprecated now, and all alternatives are .NET, which isn't very C++-friendly). But that does not really matter (who would use … | |
Re: Anyone that is concerned enough about security to commission a pentester would probably not make the blatant mistake of keeping flash players installed on their network's computers. Sounds more like you're trying to write a hack, and it seems you have a long way to go, so I won't be … | |
Re: I would also point out that you don't need to calculate the factorial from scratch at every iteration and the same for the pow(x) calls, you can just calculate them as you go along with the main loop: #define MAX_ITERATIONS 100 double cos(double x) { // Set the total sum … | |
Re: Just to add a few remarks. The [Visual Studio Express](http://www.visualstudio.com/products/visual-studio-express-vs) edition is free and completely sufficient. You only really need to pay money for development tools if you are running a mid-to-large software company, below that (small company, personal/school projects, open-source projects, etc.) you will find the free tools to … | |
Re: What have you tried so far? We don't do homeworks for people here. You have to show some efforts and ask about some specific problems that you are having with your own code. | |
Re: Sorry to hear that. My condolences. I remember when my dog died, it had quite an effect on me. Mine was a golden retriever. I think I was about 7 years old when we got him, so I grew up with him. He was very old, and died in his … ![]() | |
Re: The piece of magic code needed is [glReadPixels()](http://www.opengl.org/sdk/docs/man/xhtml/glReadPixels.xml). Like this: int width=500; int height=500; uint32_t *colours=new uint32_t[width*height]; glBegin(GL_TRIANGLES); //other drawing stuff, preferably no magic here? glEnd(); glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, colours); uint32_t c = *colours; // c should be the top-left pixel rendered by opengl I don't know … | |
Re: There are a few legitimate uses of goto, but it's not that it should ever be used carelessly. The main legitimate uses I can think of are: the "multi-break" and the "C-style cleaning". The "multi-break" refers to the problem of breaking out of a more than one nested loop at … | |
Re: Well, you have a few typos in your code, and then, you forgot the end the lines with a semi-colon `;` almost everywhere. With those small corrections, we get: const double NUM = 10; double a[NUM]; double b[NUM]; bool c; for (int d = 0; d < 10; d++) { … | |
Re: > First you get a self proclaimed expert who says it is absolutely wrong to ask for other people to write code for you It is absolutely wrong to ask for other people to write code for you. That is stated in the [Rules of Daniweb](http://www.daniweb.com/community/rules): "**Do** provide evidence of … ![]() | |
Re: > If you want to dedicate your website to someone, dedicate it to Mother Teresa, someone who is worthy of it. That's a pretty bad example. [Mother Teresa is far from being praise-worthy](http://www.youtube.com/watch?v=oR9T9oTqsXs). | |
Re: The problems with your code are not about having template members inside a class, but they are about pretty much everything else. I understand you "get several errors", but I can tell you that you are probably getting far too few errors, because there are many errors your compiler cannot … | |
Re: I don't agree that "the title says it all". I have no idea what your question is. Programming involves creating and using functions and classes, how could it possibly be not "ok", if you can't create / use functions and classes, you can't do anything. It's like asking "is using … | |
Re: The core issue is that the `std::thread` cannot guess whether you want to pass things by reference or by value, and it would not be safe or possible to assume that you want to pass things by reference, it must assume that all parameters are passed by value. The `std::ref()` … | |
Re: I think the OP is talking about plagarism detection software. This is software that can take a given document (text, code, video, etc.) and any other meta-data (title, assignment problem statement, etc.), and then scan the world (i.e., the internet) for any document that is suspiciously similar to it. This … | |
Re: As Moschops said, and also there are other extensions that are typical for header files, especially `.hpp` (the `.h` is conventionally reserved for C headers). For the rest, header files are just plain text files, like all other types of C++ source files too (cpp files are also just text … | |
Re: Your functions modify the elements of the array (i.e., swaps them during the sorting). There is no way that you can declare that as `const`, because that implies a promise never to modify the contents, but your functions require that you do so. | |
Re: > Can you find a safe way to execute an external program? What about checking a checksum on the executable before executing it? Something like this: int secure_system_call(char* app_name, char* app_md5, char* app_args) { char* test_md5 = compute_md5(app_name); int cmp_result = strcmp(test_md5, app_md5); free(test_md5); if( cmp_result == 0 ) { … | |
Re: The problem is that your reverse function takes its parameters by value, causing a (shallow) copy of the stacks: void Stack::Reverc(Stack s,Stack d,Stack c) This is wrong, for a few reasons. First of all, the stack that you seem to be reversing within that function is the `s` stack, but … | |
Re: I'm not sure that I see the Matrix-style plug-and-play memory system as being that great. I don't think that human memory is really infinite. It compresses and loses over time. What is much more appealing to me, with the same kind of tech described in that video, is the prospect … | |
Re: The saying I came up with about pointers is this: "Pointers: Beginners hate them; experts hide them." The thing that makes pointers "hard" for some is that they are too simple, ironically. A pointer is nothing more than a number (integer) that uniquely identifies a location in memory (an address). … | |
Re: First, you should use `i<101` instead of `i<=100`. Also, your for-loop could be like this `for(int i=0;++i<101;)`. That's two characters saved. However, D allows for range-based for-loops too, so you could write `foreach(i;1..101)`, that is 4 more characters saved. Then, you can, in general, replace almost any sequence of if-statements … | |
Re: > I can do it with a pencil Well, if the "completely filled square" is already done, then the hollow square could be done with an eraser! | |
Re: There used to be TeX/LaTeX support, which is what you would use to create such equations. Support for it got taken out with the move to the new system. I agreed that it was not the most commonly used feature, but when you need it, it is certainly very nice … | |
Re: I quick google search reveals that `counted_ptr` is a pre-historic version of `shared_ptr`. Unless you are using a specific (old) library that requires the use of `counted_ptr`, I must say that you should prefer using the standard `std::shared_ptr` pointer, or it's equivalent in [Boost](http://www.boost.org/) `boost::shared_ptr`. | |
Re: If you want to use a fixed selection of types, then you should use [Boost.Variant](http://www.boost.org/doc/libs/1_55_0/doc/html/variant.html) (discriminated union type, similar to that old C-style variant type in windows.h). If you want to use any types, then you should use [Boost.Any](http://www.boost.org/doc/libs/1_55_0/doc/html/any.html), which is a kind of ultimate type-erasure device. And if you … | |
Re: As far as I know, Vim or emacs or nano or any other in-terminal text editor are all implemented just using the [curses.h](http://pubs.opengroup.org/onlinepubs/007908775/xcurses/curses.h.html) library. There are ports of curses for Windows too, and I believe the Windows ports of Vim/emacs are based on that. > I've got unbuffered input, and … | |
Re: Ketsuekiame: **K**entucky's **E**tiquette and **T**raditions **S**pecialist **U**nit for **E**migrants of **K**azakhstan with **I**nsufficient **A**merican **M**anner's **E**ducation Here's the next challenge: Abracadabra | |
Re: "There are only two kinds of languages: the ones people complain about and the ones nobody uses." -- Bjarne Stroustrup | |
Re: I suspect this is not a problem related to Visual C++ but about your code. Please provide the code and the error messages that you get. | |
Re: > Non deterministic methods: present many choice and one must choose the suitable one among others(e.g. Genetic algorithms), in such case we talk about a pseudo-algorithm. We generally call that a probabilistic method, or probabilistic algorithms. This is quite different from the concepts of deterministic / non-deterministic Turing machines. A … |
The End.