2,712 Posted Topics

Member Avatar for ogrishmania

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 …

Member Avatar for mrnutty
0
286
Member Avatar for mr.white

>>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?

Member Avatar for vdavid
0
486
Member Avatar for alex910TN

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 …

Member Avatar for mrnutty
0
166
Member Avatar for gotto
Member Avatar for HunainHafeez

Innovative...hmmm Some bullshit I can think of are ... - Better design - Cleaner Interface - Great Client Usability - More stuff about good design, usability, accessability...

Member Avatar for ambitionasd31
0
250
Member Avatar for Secone

// 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; …

Member Avatar for Secone
0
186
Member Avatar for php111
Member Avatar for MattyRobot

What would google do? It would [URL="http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/"]oggle [/URL] the google baby.

Member Avatar for Mallot
0
293
Member Avatar for nitin1

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 …

Member Avatar for chris.stout
0
283
Member Avatar for Angel78

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.

Member Avatar for mrnutty
0
226
Member Avatar for rizwan.ali.1656

Yea you can greatly reduce it to something like so http://codepad.org/ZR7IGhKu

Member Avatar for ravenous
0
353
Member Avatar for Dani

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 …

Member Avatar for L7Sqr
3
1K
Member Avatar for blee93

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 …

Member Avatar for vCillusion
0
367
Member Avatar for borchu
Member Avatar for iamthwee

@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 …

Member Avatar for Mike Askew
0
437
Member Avatar for Tinnin

Initialize you letter grades. char A('A'), B('B'), C('C'), D('D'), E('E'), F('F');

Member Avatar for Tinnin
0
124
Member Avatar for Redhaze46

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 …

Member Avatar for mrnutty
1
230
Member Avatar for crissium

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?

Member Avatar for crissium
0
159
Member Avatar for Lilith24
Member Avatar for Troy III
0
390
Member Avatar for nitin1

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 …

Member Avatar for mrnutty
0
161
Member Avatar for nitin1
Member Avatar for Bumpehh

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.

Member Avatar for Bumpehh
0
125
Member Avatar for np complete

>>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 …

Member Avatar for np complete
1
1K
Member Avatar for GrimJack

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.

Member Avatar for vinnitro
1
3K
Member Avatar for mamdouhweb

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 …

Member Avatar for phorce
0
374
Member Avatar for Bumpehh

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 }; …

Member Avatar for m4ster_r0shi
0
1K
Member Avatar for mrnutty

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 …

Member Avatar for _avishek
0
217
Member Avatar for vinnitro

You listed the answer, 1 = 5 therefore 5 = 1. Sometimes simplicity is overlooked.

Member Avatar for mrnutty
0
97
Member Avatar for powerdink

[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

Member Avatar for Brandon5122
0
6K
Member Avatar for while(!success)

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(); } …

Member Avatar for while(!success)
0
4K
Member Avatar for sillyboy
Member Avatar for osiron
Re: MVC

What exactly is the problem? What isn't working? What are you seeing versus expecting?

Member Avatar for mrnutty
0
193
Member Avatar for lil_bit

Can you provide a tl;dr version for the lazy like me? *tl;dr = too long, didn't read

Member Avatar for Reverend Jim
1
207
Member Avatar for Nikhar
Member Avatar for Labdabeta

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 …

Member Avatar for VernonDozier
0
253
Member Avatar for Geeksoftie

> 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

Member Avatar for L7Sqr
0
148
Member Avatar for lil_bit

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: …

Member Avatar for mrnutty
0
211
Member Avatar for salah_saleh

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 …

Member Avatar for salah_saleh
0
120
Member Avatar for NoUserNameHere

Never seen this concept in discrete, but I'm guessing so because one loop looks like it influences the other

Member Avatar for odubanjo.ismail
0
67
Member Avatar for Remy the cook

Instead of passing 'x' pass in a struct, but make sure to cast it as necessary

Member Avatar for Lucaci Andrew
0
224
Member Avatar for triumphost

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.

Member Avatar for mike_2000_17
0
216
Member Avatar for mrnutty

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 …

Member Avatar for ndeniche
1
233
Member Avatar for phorce

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.

Member Avatar for phorce
0
187
Member Avatar for Qusto

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.

Member Avatar for Topiary
1
153
Member Avatar for dark_sider_1

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

Member Avatar for dark_sider_1
0
76
Member Avatar for triumphost

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); } };

Member Avatar for mrnutty
0
138
Member Avatar for apanimesh061

Matlab would be a easier starting point. It already has many functions implemented for you to handle audio processing.

Member Avatar for mrnutty
0
83
Member Avatar for DonutsnCode

@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 …

Member Avatar for elmohler
0
940
Member Avatar for altec64

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

Member Avatar for mrnutty
0
1K
Member Avatar for Sunshine2011

> 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.

Member Avatar for Sunshine2011
0
237

The End.