2,712 Posted Topics
Re: So first you should know that although multiple inheritance is frowned upon by some people, that doesn't necessairly make it wrong. Second, it is an accepted design if you inherit from multiple interface. So simple example( the size, display ) you can characeterize each property into some catagory and make … | |
Re: >>So, how do i go from coordinates the position of sun rays to creating dots that separate illuminated (day) portion of earth on a flat map from dark portion? Can you clarify a bit more? | |
Re: Yes in C++ you can return a pointer by reference, doing so will allow you to change the pointing address of the pointer and have it affect out of scope. For example void reallocateRef(Node*& node, int newValue){ node = new Node(newValue); } void reallocateNoRef(Node* node, int newValue){ node = new … | |
Re: Do you have a website? You can use java::Applet to embed java stuff on web. | |
Re: Innovative...hmmm Some bullshit I can think of are ... - Better design - Cleaner Interface - Great Client Usability - More stuff about good design, usability, accessability... | |
Re: // Append element to array template <class eltType> Array<eltType> &Array<eltType>::operator+=(eltType elt, const Array<eltType> &A) { if (A.itemsUsed() != A.size()) { elements[A.itemsUsed() + 1] = elt; A.incItemAmt(); } else if (A.itemsUsed() == A.size()) { eltType *temp=new eltType[capacity+1]; for (int i = 0; i < size(); ++i) temp[i]=elements[i]; temp[capacity++]=elt; delete [] elements; … | |
| |
Re: What would google do? It would [URL="http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/"]oggle [/URL] the google baby. | |
Re: Maybe three? [h1 h2 h3 h4 h5 h6 h7 h8 h9] Race 1: [h1 h2 h3] -> hi = 1st place finisher Race 2: [h4 h5 h6] -> hj = 1st place finisher Race 3: [h7 h8 h9] -> hk = 1st place finisher [hi, hj, hk] would be the … | |
Re: First problem, your function name and variable are same, more specifically, newLink is declared as a function then inside, you have newLink as variable. Change the variable name to something else like newLinkElement. | |
Re: Yea you can greatly reduce it to something like so http://codepad.org/ZR7IGhKu | |
Re: I would like to suggest to create a seperate sub-forum specifically for this purpose. Thus it will be more maintainable and easier to look through different snippets from different language. It also avoids that popularity advantage. This event needs to be so more formal. I really don't know what to … | |
Re: Integer range : –2,147,483,648 to 2,147,483,647 unsigned integer range : 0 to 4,294,967,295 unsigned long long range : 0 to 18,446,744,073,709,551,615 so a integer cannot go up to 600851475143, so use long long type. Also I would suggest for you to start from the number 600851475143 - 2 and go … | |
Re: You need to start k at 1. | |
![]() | Re: @imathewee, my friend gave me this ecopy of a famous book called Big Beyond Belief, it takes a really scientific approach to working out, and explains in essential details of eating/form/training/resting and everything else. At the end it gives you a choice of 3 optimal workout that you can choose … |
Re: Initialize you letter grades. char A('A'), B('B'), C('C'), D('D'), E('E'), F('F'); | |
Re: You might want to do an easier alternative. For example, say you write a code in a text file like so : [code] //code.txt START_PROGRAM print "hello world" END_PROGRAM [/code] That file contains your new programming language code. Now you can use C++ to read in the file, and parse … | |
Re: Taking a quick look, " index=sub.find_first_not_of("aeuio"); cout << "first consonant:"<< sub[index]<<endl; " what happens when that find_first_not_of fails? | |
Re: The second one should be invalid, since p2 isn't defined. That shouldn't work. | |
Re: Does the suffix array need to handle only one word? Is the amount of word to represent by the suffix tree not bound? Your example seems trivial, meaning that you can simply just use std::string to hold a string data and print out the suffix tree by for loops. How … | |
Re: Go for sfml, but there might be more documentation on sdl. Check out [gamedev](http://www.gamedev.net/forum/21-general-programming/), they are generally good with helping with graphics. Or you can post here and we'll help as well. Just get some simple screen gonig on sfml then move on further from there. | |
Re: >>difference = fabs(f - arr[ i+1 ]); That will be out of bounds in the case where i = (h-1) since arr[h] is not valid, because index stats at 0. >>smallest[h] You also shouldn't be allowed to create a variable sized static array. Basically your algorithm is finding the smallest … | |
Re: when you say, "back in my day...". -------------------------------------------------------- Just for curiosity, whats the age group here in Daniweb? Anyone want to tell their age? I'm 19. | |
Re: You can't rely on people to help you all the time. The point of this project is not only for you to be able to do large complex project but also research and do stuff on your own. This is the internet. There are plenty of sources. First you need … | |
Re: Didnt compile it but just to show some of the things you should be doing is breaking things into functions and using constants. #include <iostream> using namespace std; enum WeaponType{ ROCK, PAPER, SCISSOR, MAX_OPT}; enum GameStatus{ PLAYER_WIN, DRAW_GAME, PLAYER_LOSS }; static const WeaponType options[MAX_OPT] = { ROCK, PAPER, SCISSOR }; … | |
The Step Forward The path that I have taken in life seems to be the path that many follow. Although weird at first, this path seems to lead to the same end goal for each and every one of us, which is to find happiness, whatever that may be. Let’s … | |
Re: You listed the answer, 1 = 5 therefore 5 = 1. Sometimes simplicity is overlooked. | |
Re: [CODE]if (currentDay = 0)[/CODE] you want to compare not assign, in another words [CODE]if (currentDay == 0)[/CODE] do that for all of your similar if statements | |
Re: For that case you need to define what empty means. For example it could be this struct Foo{ int x; string y; Foo(): x(0), y(){}; } //it is empty only if x == 0 and y contains no letter bool isEmpty(const Foo& f){ return x == 0 && y.empty(); } … | |
Re: What exactly is the problem? What isn't working? What are you seeing versus expecting? | |
Re: Can you provide a tl;dr version for the lazy like me? *tl;dr = too long, didn't read | |
Re: How are you creating your project? | |
Re: First you want to look at batch programming, at least I think that's a good starting point to showoff to your friends. Second, grow some balls. Who cares what they think? Why do you need to impress them. They are not programmers and probably never will be. They do not … | |
Re: > Although, to be efficient you would probably want to implement a caching scheme to that search to prevent having to search every node each time you call quad_max. Or if its needed frequently, just have a variable to keep track of current max/min | |
Re: Since you are using C++ maybe avoid using C stuff. #include <iostream> #include <cstdio> #include <vector> #include <string> #include <algorithm> using namespace std; struct RemoveFile{ bool operator(const std::string& fileToRemove)const{ if( std::remove( fileToRemove.c_str() ) ){ std::cout << "removed: " << fileToRemove << endl; return true; }else{ std::cout << "failed to remove: … | |
Re: if g = 0 then i can range from 0 to m if g = 1 then i can range from 1 to m ... if g = (m-1) then i can range from (m-1) to m What I am trying to get at is, you cannot get a unique … | |
Re: Never seen this concept in discrete, but I'm guessing so because one loop looks like it influences the other | |
Re: Instead of passing 'x' pass in a struct, but make sure to cast it as necessary | |
Re: Either manually make sure the vector size isn't correct, or use an static array, or inherit from vector and make the resize function private. | |
And I have partly to thank you guys. I joined DW a while back only occasionly used it. Then stoped. Then started using it more and more. Over the years it has been great. Everything has been great. Everyone has been great. I wish it was possible that we could … | |
Re: Another option is to make a File struct. struct FileInfo{ std::string name; //possibly other things explicit FileInfo(const std::string& name = ""): name(name){} } class Lexical{ ReturnType read(const std::string& sentence); ReturnType read(const FileInfo& fileInfo); } but I suggest to go the istream route as suggested in previous post. | |
Re: use std::auto_ptr instead of raw pointers. Use boost's smart pointers instead of raw pointers. Make sure every call to new is matched with a call to delete. | |
Re: Can you place them just before an actual collision could happen? Since they are static object there should be no problem with worrying about them moving | |
Re: You're looking for[ conversion operator](http://msdn.microsoft.com/en-us/library/0t2cwh7y(v=vs.80).aspx). Something like class Point{ private: int x,y; public: operatir POINT()const{ return POINT(x,y); } }; | |
Re: Matlab would be a easier starting point. It already has many functions implemented for you to handle audio processing. | |
Re: @OP: Usually you should avoid the usage of static keyword. To further explain the problem consider what happens here : [code] int x = 10; int &y = x; y = 20; //x = 20 as well [/code] Since y is a reference to x. Changing y will also change … | |
Re: Maybe you want to take a more object oriented approach at this just to gain some experience. Check out the [Command Pattern](http://en.wikipedia.org/wiki/Command_pattern). Fits very well for redo-undo stuff | |
Re: > How could one insert new elements in the vector ? By using std::vector::push_back or std::vector::insert function > Would it be a good idea to create the vector within the class / the constructor? Sure, if you need an array of something, then std::vector is usually a good choice. |
The End.