2,712 Posted Topics

Member Avatar for pkrdimos
Member Avatar for mrnutty
0
204
Member Avatar for That_Dude
Member Avatar for mike_2000_17
0
725
Member Avatar for varun.sharma
Member Avatar for mrnutty
0
48
Member Avatar for gunjannigam
Member Avatar for AppB
0
144
Member Avatar for kkreisler

Google Pascal's triangle, which is what I think essentially you are creating using 2d array.

Member Avatar for mrnutty
0
107
Member Avatar for triumphost

[QUOTE=triumphost;1688899]How would I do it in C++?[/QUOTE] you can't do that with just pure C++. You will have to use external libraries like ncurses

Member Avatar for thines01
0
361
Member Avatar for DoinWork

I'm assuming by internal node you mean all nodes except the leaf nodes? If so then possibly give this a try( haven't tested it ) [code] bool hasLeftChild(const Node*const p){ return p->left != NULL; } bool hasRightChild(const Node* const p){ return p->right != NULL; } bool isLeaf(const Node* const p){ …

Member Avatar for DoinWork
0
435
Member Avatar for ben1996123

In your main, do you include the needed files? What is the exact error? Make sure, wherever you get an undeclared error, you include the proper files?

Member Avatar for ben1996123
0
355
Member Avatar for enrichedd

To determine the volume you use this formula [URL="http://upload.wikimedia.org/wikipedia/en/math/0/e/a/0eae0266bab94d83279731d80d5ff636.png"]general volume formule[/URL] where: h = any dimension of the figure, A(h) = area of the cross-sections perpendicular to h described as a function of the position along h. a and b are the limits of integration for the volumetric sweep. (This …

Member Avatar for mrnutty
0
104
Member Avatar for valestrom

Couple of points. 1) Remove char arrays and use std::string. 2) Looking at the problem you can see that every different enemy will have different stats but in general will have same functions(i.e attack defend ), hence this suggest to create a polymorphic behavior. So I would suggest to do …

Member Avatar for valestrom
0
296
Member Avatar for xfbs

yes I am! [URL="https://github.com/dchhetri"]https://github.com/dchhetri[/URL]

Member Avatar for peter_budo
0
253
Member Avatar for mrnutty

[B]Problem question:[/B] Given the sequence A and B, where A is the inorder traversal value and B is the pre-order traversal value, reconstruct the binary tree that produces such results when performing inorder and pre-order traversal on that binary tree. To reconstruct the binary tree you can simply print the …

Member Avatar for vidit_X
0
372
Member Avatar for janejackson87

>>[B]Most of the time you'll see encapsulation rolled up along with data hiding, which while appropriate, is technically incorrect[/B] care to expand?

Member Avatar for mike_2000_17
0
202
Member Avatar for Arjunah
Member Avatar for Brokenpwn

You should need to pace yourself. First learn concepts of programming. Get a good grasp of it. Learn's the ins and outs of one programming language. Learn about data structure. Learn about algorithms. Practice more and more. Then once you feel you have gotten a good grasp, then do some …

Member Avatar for Serapth
0
210
Member Avatar for George_91

>>[B]for(int high = n-1; i= low; high-- )[/B] Check the condition. The expression syntax is [icode] for(variable decleration,condition, operations)[/icode] When you say "i = low" as a condition, you are saying "i = 0" since low is 0, which is false since 0 is considered false.

Member Avatar for George_91
0
190
Member Avatar for marco1497

>>Why are programming languages dissimilar even if they go after the similar compilation procedure? Maybe a simple answer is that, people weren't satisfied with the current programming language, hence tried to build a "stronger" and more expressive language; this caused the variation of tools to be created.

Member Avatar for JeffGrigg
0
257
Member Avatar for phorce
Member Avatar for MartinRinehart
0
93
Member Avatar for stereomatching

1) typeid(type) does not return a unique object in all cases. You might want to combine (typeid(type).name(),instanceNumber) as a key. 2) typeid(type) is not unique 3) HashTable

Member Avatar for vijayan121
0
872
Member Avatar for Muckytears

Yes possible. You will constantly have to monitor the keypress of your computer and on a certain combination key pressed, you can positioned the mouse to some absolute coordinate.

Member Avatar for raptr_dflo
0
155
Member Avatar for cwarn23

how about just "abcdefghijklmnopqrstuvwxyz"? Its minimal as possible. And it could be considered as a sentence if you add a period at the end.

Member Avatar for cwarn23
0
114
Member Avatar for eRayven38
Member Avatar for jonnyboy12

The compiler will compile only relavant portion of the code. If you change Y and X depends on Y, then Y and X will get compiled and all files that depends on X will get compiled. If you want to reduce your compile time, you may want to take a …

Member Avatar for jonnyboy12
0
104
Member Avatar for reddit
Member Avatar for anushabit

First figure out how to reverse one word, ex [hello] --> [olleh]. Then go on from there. There are many ways you can achieve this. Why don't you give it a try and come back if you have problem.

Member Avatar for mrnutty
0
94
Member Avatar for tucker001

What problem are you having? Maybe a simple example will get you started. A simple multiplication table. [code] #include <iostream> using namespace std; int main(){ const int MAX = 5; //show row metadata cout << "\t"; for(int n = 0; n < MAX; ++n){ cout << n << "\t"; } …

Member Avatar for mrnutty
0
169
Member Avatar for carolinatech

Note that although a greedy approach to this problem is optimal, its not a general solution to an optimal solution for all coins. For a general optimal solution, one can use dynamic programming.

Member Avatar for Stazloz
0
130
Member Avatar for chiiqui

All algorithm you need to know are usually already implemented efficiently by the libraries or some other well known vendors. Your job should be to efficiently use them to complete your project and increase your productivity. Of course this doesn't mean you shouldn't know that basic concepts, like sorting, trees, …

Member Avatar for JeffGrigg
0
235
Member Avatar for Cross213

See the difference between the two: [code] //in .h void inorder(nodeType *p) const; void preorder(nodeType *p) const; void postorder(nodeType *p) const; [/code] [code] //in main b.inorder(); b.preorder(); b.postorder(); [/code]

Member Avatar for Cross213
0
98
Member Avatar for DeusManP0W

Put training1 definition above training2 definition. Also put a "return 0;" in the last line in main. Also use "#include<iostream>" not #include <iostream.h>"

Member Avatar for DeusManP0W
0
1K
Member Avatar for Groovemix
Member Avatar for TheFearful

For P2 its easy to come up with a O(n*m) \in O(n^2) solution, but can you come up with a linear time algorithm, possibly in O(n+m), where n is the length of the p and m is the length of q?

Member Avatar for raptr_dflo
0
337
Member Avatar for myrongainz

Reverse the whole string( ex [hello] -> [olleh] ) then split the result into pairs( ex split pair of 2 [olleh] -> [ol le h]). If you are just outputting it, then output a space at every split position.

Member Avatar for mrnutty
0
175
Member Avatar for Interista

Sure. First realize that Menu's can be recursive, that is you can have menues inside menus. For example, you can have a top level menu called, Clothes which contains sub-menus like sports clothes or winter clothes. Noticing this recursive structure, might hint that a tree implementation might be a natural …

Member Avatar for Interista
0
701
Member Avatar for ayeshashahid

>>Polish a turd and it's still a turd. But its a cleaner turd? Anyways, who wants to touch a turd anyways, grosss lol. As per the application of bubble-sort, the only place I seen it was in my introductory course. But even then I don't know if that is really …

Member Avatar for ayeshashahid
-1
2K
Member Avatar for ronak127

[QUOTE][CODE]div = num1 / num2; remainder = num1 % num2;[/CODE][/QUOTE] 1)Let num1 = 6 and num2 = 3. Then div = 6/3 = 2. and the remainder 6%3 = 0. 2)[QUOTE][CODE]if (num1 < num2) { div = num1; num1 = num2; num2 = div; }[/CODE][/QUOTE] This is irrelevant in the …

Member Avatar for mrnutty
0
180
Member Avatar for SoftwareGuy

>>Weird and redundant, isn't it? For now yes, but if you guys decide to not use "_T" then you can simply change the macro definition instead of changing the code a whole lot for accommodate the new type.

Member Avatar for SoftwareGuy
0
247
Member Avatar for bennetk2

This [icode]int zero(float);[/icode] has to match this [icode]int zero(float a[9][13])[/icode]. Same goes for the rest.

Member Avatar for raptr_dflo
0
377
Member Avatar for blackrobe

The idea is simple once you know it. You need to store the diff values into hash, in order to get it in linear time*. Here is the idea: 1) Combine S1 and S2, call it S 2) For each element in S, check if the difference is in the …

Member Avatar for Taywin
0
542
Member Avatar for Warhead88

[URL="http://en.wikipedia.org/wiki/Hash_table"]wiki[/URL] is always a good starting point. What exactly is troubling you?

Member Avatar for Warhead88
0
335
Member Avatar for slygoth

Not sure if its clear what you want to do. Do you want to write a C++ program where it takes a file path to a image or music and opens the file using appropriate application like ms-paint for images or windows media player for music? Or do you want …

Member Avatar for slygoth
0
2K
Member Avatar for Oscariuz

I think what you want to see is if the combination of (r,s,d) results in some winning combination? Is that correct. For example if R = $ and S = $ and D = $, then you would win some large amount? If so then you can simply do something …

Member Avatar for mrnutty
0
210
Member Avatar for HASHMI007

You need to make sure that it maintains a heap structure, that is the highest priority( or the lowest) is constantly at the top. So whenever a user inserts or deletes a node, you still need to maintain that property. There are several ways of doing this, check [URL="http://en.wikipedia.org/wiki/Priority_queue"]here[/URL] for …

Member Avatar for HASHMI007
0
179
Member Avatar for cyberguy007

Assuming same things as Narue, you can also just peek the character without reading it, just in case the file is not empty. [code] #include<iostream> #include<fstream> using namespace std; int main() { ifstream read("test.txt"); if(!read) return 0; bool isEmpty = read.peek() == EOF; cout << boolalpha << "test is empty …

Member Avatar for sanof3322
0
30K
Member Avatar for toneranger
Member Avatar for imolorhe

Check [URL="http://www-graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2Float"]this[/URL] site out. It shows you many bit hacking solutions. If you program in a closed, restricted and limited programming hardware, they come to use.

Member Avatar for daddymummy
0
227
Member Avatar for George_91

An example: [code] #include <ctime> #include <vector> #include <iostream> #include <algorithm> using namespace std; int getRandom(){ return rand() % 500; } int main(){ srand(time(0)); //seed random number function int size = 0; cout << "Enter size: "; cin >> size; std::vector<int> data(size,0); // contains size number of 0's std::generate(data.begin(), data.end(), …

Member Avatar for George_91
0
2K
Member Avatar for digipak

[CODE]class Pdisk { public : Pdisk(string diskname, int numberofblocks, int blocksize); [COLOR="Red"]Pdisk(): numberofblocks(0), blocksize(0){}[/COLOR] //default ctor private : string diskname; int numberofblocks; int blocksize; };[/CODE]

Member Avatar for StuXYZ
0
507
Member Avatar for maybnxtseasn

>>How are you supposed to deal with teachers that are no longer hired? You would presumably have a function to fire teacher: [code] class Department { private: Teacher *m_pcTeacher; // This dept holds only one teacher public: Department(Teacher *pcTeacher=NULL) : m_pcTeacher(pcTeacher) { } void fireTeacher(const Teacher* t){ if( t == …

Member Avatar for maybnxtseasn
0
118
Member Avatar for KyleSmith10

I'm not sure what exactly you want. Do you want to extract each NodeArray[i] into its own array?

Member Avatar for KyleSmith10
0
249

The End.