2,712 Posted Topics
Re: Maybe give openGL a look. Not sure how well Embarcadero's tools would fit into that. | |
Re: Keywords, "Bode-plots", "Graphics" Response: Use Matlab, that's what it was made for. | |
Re: Paste code here, People (including me) are too lazy to download | |
Re: go with opengl(open graphics library) or jogl (java opengl). | |
Re: Google Pascal's triangle, which is what I think essentially you are creating using 2d array. | |
Re: [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 | |
Re: 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){ … | |
Re: 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? | |
Re: 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 … | |
Re: 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 … | |
Re: yes I am! [URL="https://github.com/dchhetri"]https://github.com/dchhetri[/URL] | |
[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 … | |
Re: >>[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? | |
Re: Yup I agree. Copy line 21 and place it in line 3 | |
Re: 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 … | |
Re: >>[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. | |
Re: >>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. | |
Re: You need to take into account the margin and padding as well. | |
Re: 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 | |
Re: 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. | |
Re: how about just "abcdefghijklmnopqrstuvwxyz"? Its minimal as possible. And it could be considered as a sentence if you add a period at the end. | |
Re: The question isn't very clear to me neither. | |
Re: 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 … | |
Re: 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. | |
Re: 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"; } … | |
Re: 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. | |
Re: 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, … | |
Re: 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] | |
Re: 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>" | |
| |
![]() | Re: 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? |
Re: 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. | |
Re: 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 … | |
Re: >>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 … | |
Re: [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 … | |
Re: >>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. | |
Re: This [icode]int zero(float);[/icode] has to match this [icode]int zero(float a[9][13])[/icode]. Same goes for the rest. | |
Re: 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 … | |
Re: [URL="http://en.wikipedia.org/wiki/Hash_table"]wiki[/URL] is always a good starting point. What exactly is troubling you? | |
Re: 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 … | |
Re: 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 … | |
![]() | Re: 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 … ![]() |
Re: 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 … | |
Re: First of all, what do you intend to do with the data? | |
Re: 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. | |
Re: 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(), … | |
Re: [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] | |
Re: >>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 == … | |
Re: I'm not sure what exactly you want. Do you want to extract each NodeArray[i] into its own array? |
The End.