2,712 Posted Topics

Member Avatar for Suzie999

Is that function a virtual function, can you change its sigs? Why not return a `std::pair<bool,Handle>` ?

Member Avatar for Suzie999
0
1K
Member Avatar for nah094020

Your code seems fine, it might be how you setup the environment. How'd you set up your environment? I haven't used netbeans in years. But typically in any ide, there is an option to create a C++ project. Did you try to run a simple hello-world program and see if …

Member Avatar for nah094020
0
502
Member Avatar for dan.gerald

bool operator==(const Birthday &x, const Birthday &y) { if ((x->getMonth() == y->getMonth()) && (x->getDay() == y->getDay()))//i am getting errors here return true; else return false; } Bad syntax above, try this: bool operator==(const Birthday &x, const Birthday &y) { return (x.getMonth() == y.getMonth()) && (x.getDay() == y.getDay()); }

Member Avatar for dan.gerald
0
507
Member Avatar for group256
Member Avatar for MRehanQadri
Member Avatar for mike_2000_17
0
135
Member Avatar for mrnutty

Gravatar is getting really popular, may sites like stackoverflow or github have incorporated the avatars. It would be nice to have a consistent avatar throughout all forums and sites.

Member Avatar for mrnutty
0
231
Member Avatar for FearlessHornet

I hope you know that `std::string` has a `find` method in which you can use to find another string. So for your Contains function, you can simply so something like so: bool contains(const std::string& target, const std::string& src, bool ignoreCasing = false){ const std::string& adjustedSrc = ignoreCasing ? toLower( src …

Member Avatar for mrnutty
0
228
Member Avatar for ConfusedLearner

In C++ `1/2 = 0` because of inteeger division. Thus you want something like so: float divide(float x, float y){ return x/y;} int main(){ float x = 0, y = 1; cin >> x >> y; cout << divide(x,y) << endl; }

Member Avatar for mrnutty
0
128
Member Avatar for dachy12

You want to get the input and set the member variables: #include<iostream> #include<string> using namespace std; class student { public: void input(); float GPA() const; void Display() const; private: string name; int id; int grade1; int grade2; int grade3; }; int main() { student kyle(name, id, grade1,grade2,grade3); kyle.Display(); return 0; …

Member Avatar for dachy12
0
124
Member Avatar for mrnutty

## I know we haven't been doing much of these C++ Community problems so I though I'd write one up to get it started once again.## **Problem Statement:** For some integer `v,w,x,y,z` find all solution to the following equation 1 1 1 1 1 - + - + - + …

Member Avatar for mrnutty
0
119
Member Avatar for A Haunted Army

if(Clock.GetTime() >= FPS){ Screen->StartFrame(); Player.Draw(); Screen->ShowFrame(); Clock.Start(); } Why do you do Clock.start() here again? A better way to handle it is like so: if(Clock.GetTime() >= FPS){ Clock::TimeDiff diffTime = Clock.GetTime() - FPS; updatePhysics(diffTime); updateEntities(diffTime); } Check out a full tutoial [here](http://gafferongames.com/game-physics/fix-your-timestep/)

Member Avatar for A Haunted Army
0
1K
Member Avatar for deceptikon

Hmm...seems like its a little more complicated than it needs to be. Some of your algorithms can be simplified using the algorithms in the string library, for example: std::string GetExtension(const std::string& filename){ _validate(); //your exception validation auto endExtensionPosition = filename.find_last_of('.'); auto endPathSeperatorPosition = filename.find_last_of("/\\"); if(endPathSeperatorPosition > endExtensionPosition || endExtensionPosition != …

Member Avatar for deceptikon
0
401
Member Avatar for Hopp3r

If you don't know the size of the parameter 'a' in your example, then it is not possible to correctly write the needed logic with the given information. Sure we can assume things such as the char array is null terminated which is a natural assumtion in this case, but …

Member Avatar for NathanOliver
0
2K
Member Avatar for babuliy

There are so so many tutorials online about this. I'm not sure what you are confused by. As a quick glimpse, consider the following code: //base class struct Base{ int x; virtual ~Base(){}; }; //inherit properties and method from Base class struct Derived: Base{ int y; }; After the derived …

Member Avatar for CGSMCMLXXV
0
137
Member Avatar for finders

Seems like you need to first understand how to convert binary to decimal before actually programming it. Take for example the binary number `1010` which is 10 in decimal. How can we get to it mathmatically? Pretty easy actually, what you can do is sum up pow(2,nextOnePosition). For example, 1010 …

Member Avatar for CGSMCMLXXV
0
803
Member Avatar for pivren

I think you want something like so: #include <iostream> #include <fstream> int main(){ using namespace std; ofstream fileOutput("data.dat",ios::app); //open for appending cout << "What is your favorite number: "; //print to standard output the question int favNum; //create variable to store number cin >> favNum; //read response from user from …

Member Avatar for mrnutty
0
335
Member Avatar for shawronie

Few reasons why I prefer google than others - It is popular, usually crowd knows best in the realm of technology - It is fast - It returns better search results than other few search engines that I've tried - And is continually building

Member Avatar for weighingsumo123
0
177
Member Avatar for MiCro0o

Check it [out](http://codepad.org/ydLbWKA3). For some numbers like 101,`reverse(110)` returns 11. So your reverse function isn't completely correct.

Member Avatar for mitrmkar
0
278
Member Avatar for newbieha

From the given language, try to write some sample events generated by the given language. Then that might help you formulate a grammar for the general case.

Member Avatar for TrustyTony
-2
78
Member Avatar for mrnutty

What's up ladies and gents. I've been lacking motivation to program lately. I've been doing a little programming here and there, but I work so I mostly program for my job. However, whenever I have free time, I use to program a lot, but that motivation and has been gone …

Member Avatar for kemcar
0
190
Member Avatar for ProximaC
Member Avatar for johnandersen24

Try `cout << timeFunction( standardDeviation<delctype(v)>, v);` Why don't you make your timeFunction a template parameter as well?

Member Avatar for mike_2000_17
0
657
Member Avatar for SumTingWong59

- Check if the board is full, meaning that all cells are occupied and not empty - Then make sure there aren't any winning patterns for 'x' -- use your checkAll('x') - Then make sure there aren't any winning patterns for 'o' -- use your checkAll('o') - If all the …

Member Avatar for TrustyTony
0
141
Member Avatar for Doogledude123
Member Avatar for arpitagrawal294

>> int ch, count=0, desc[10]; This is wrong decleration for desc, what you want as suggested is const int MAX_SIZE = 10; desc descriptions[MAX_SIZE] Then on each function you will pass in descriptions and MAX_SIZE like so void del(desc[] descriptions, const int MAX_SIZE, int targetCode){ for(int i = 0; i …

Member Avatar for arpitagrawal294
1
193
Member Avatar for kedxu

@L7Sqr method1 and method2 do two different things. Consider method1(0) and method2(0). In method1 all if gets executed in method2 only the first if gets executed. So I want to make note of the logistic difference between multiple if versus elseif

Member Avatar for deceptikon
0
212
Member Avatar for Chuckleluck

Are you rectangles rotated? Do you expect us to just write one for you? Or do you have a specific question?

Member Avatar for bguild
0
357
Member Avatar for AndrewEPage

testClass c ; c.flag = true ; c.flag = false ; c.flag = true ; Can someone explain why this would be a good idea? It seems like a lot of work for little benifit.

Member Avatar for mrnutty
0
3K
Member Avatar for silvercats

Rather than trying to explain, I'll [link](http://www.cplusplus.com/doc/tutorial/namespaces/) you to a article that talks about namespace. In general for simple question you should try to be more independent. Take care.

Member Avatar for NP-complete
0
197
Member Avatar for sandorlev

If you are returning by value on built in type, don't return it constant. It might confuse the user, but its arguable. See [here](http://www.gotw.ca/gotw/006.htm)

Member Avatar for mrnutty
0
244
Member Avatar for mrnutty

I've been just working at this new enhancement for my company for these few months. I feel like my design is actually good in fact one of the best I've written. But don't be mistaken, it probably isn't the best there could be, I just tried to do my best …

Member Avatar for mrnutty
0
240
Member Avatar for kshahnazari

@Gonbe, I think he wants to know if an arary is a subarray of another array at same position. For example 1 2 4 5 is a subarray of 1 2 3 4 5 6 however 2 1 5 4 not a subarray of 1 2 3 4 5 6 …

Member Avatar for mrnutty
0
231
Member Avatar for rocksoad23

Yes. here is an example class A{ public: void foo(){ cout << "A" << endl; } }; class B{ public: B(A& a){ a.foo(); } }; int main(){ A a; B b(a); //b will call a.foo in its constructor }

Member Avatar for rubberman
0
319
Member Avatar for gfp91

Well you can do something like so: Vector3 nextCircularPosition(const Vector3& currentPosition, float angle, float radius){ return Vector3( currentPosition + cos(angle)*radius, currentPosition + sin(angle)*radius } void display(){ Object.position = nextCircularPosition(Object.position,currentAngle,radius); }

Member Avatar for mrnutty
0
104
Member Avatar for myk45

Somthing like this perhaps template<typename FirstContainer, typename SecondContainer, typename BinaryOp> void iterateTwoContainer(const FirstContainer& firstList, const SecondContainer& secondList, const BinaryOp op2){ for(int i = 0; i < firstList.size(); ++i){ for(int j = 0; j < secondList.size(); ++j){ op2(firstList[i],secondList[j]); } } } void handleItemAndToys(const Item1& item, const Toy& toy){/*...*/} void handleItemAndApples(const Item2& …

Member Avatar for myk45
0
192
Member Avatar for Hey90
Member Avatar for thompsonSensibl

It is conventional and more readable to use a for loop or a foreach loop, if the language has one. for(int i = 0; i < array.Count; ++i){ Console.Write( array[i] ); }

Member Avatar for mrnutty
0
178
Member Avatar for deepecstasy

>>leaf = leaf->left; //move leaf 1 time to right That comment conflicts with that is written. >>leaf->key_value = temp->key_value; //assigning temp's key to leaf That's not really needed since leaf is going to be deleted right. Also I'm not sure why you are treating left-child different than right child when …

Member Avatar for mrnutty
0
268
Member Avatar for MiniApocalypse
Member Avatar for mrnutty
0
192
Member Avatar for ariel930

Also note that you might be able to skip transversal if the number of nodes isn't a power of 2. If it is, then you have to transverse just to make sure it fits the definition.

Member Avatar for yde
0
874
Member Avatar for hainguyen178

I know the question was who, but lets cover more ground my casting it to what. What makes me happy are the things I love to do and enjoy. Some of which are * Spending time with family * Spending time with my brother, more specifically * Playing basketball * …

Member Avatar for <M/>
2
166
Member Avatar for CodyM

> Set::Node* cons(int x) The proper syntax is Node* Set:::cons(int x) Similar for the other decleration as well.

Member Avatar for mrnutty
0
198
Member Avatar for frederick.wright.338

what language is this? Its hitting default because none of the cases match, try printing out target and see what it shows and try to match it to the case statement. You might just want to check if target contains('Erikpl') to avoid the extra stuff.

Member Avatar for mrnutty
0
96
Member Avatar for ulrik m.

Accessing arrays doesn't necessiarly have to throw out of bounds exception, at least I don't think that is a standard requirement. Are you in debug mode? Try running it on release mode and see if it throws an exception or crashes?

Member Avatar for ulrik m.
0
314
Member Avatar for aramil daern

[QUOTE=Ancient Dragon;1679296]despite the infinite loop at the end of main().[/QUOTE] Actually, its finite, the condition is infinite, but this doesn't necessarily mean the loop is infinite. The same code but more OOP style: [code] #include <iostream> #include <string> class Application{ private: std::string title; public: Application(){} Application(const std::string& titleName) : title(titleName){} …

Member Avatar for Echo89
1
485
Member Avatar for Hanna Jane

First you need to know the [URL="http://hyperphysics.phy-astr.gsu.edu/Hbase/mot.html"]Kinematic Equations[/URL] You can use them to model projectile motion. 1) Have a initial position, initial velocity, final position, final velocity, and acceleration. The acceleration is what is going to make your projectile motion a projectile motion. Here is another refrence , [URL="http://en.wikipedia.org/wiki/Equations_of_motion"]Link[/URL] Particularly, …

Member Avatar for saurabh5584
0
3K
Member Avatar for jorge.carmonajr

Yea you seem to be a little confused. First here is how you should declare the class, doing things for simplicity right now. class Coordinate{ //declare a class named Coordinate private: float x; //has a member variable x float y; //has a member variable y float z; //has a member …

Member Avatar for mrnutty
0
123
Member Avatar for DaMaskMan2
Member Avatar for nmajon

What do you need help with exactly? Start by creating a class which has a char* as a member variable. And get it to allocate when calling the constructor. Then go on from there.

Member Avatar for mrnutty
0
123
Member Avatar for dot_binary

You need to also limit your frame rate. See [this](http://gafferongames.com/game-physics/fix-your-timestep/) site for a good reference and code.

Member Avatar for mrnutty
0
171

The End.