- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 15
- Posts with Upvotes
- 13
- Upvoting Members
- 13
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 4
Re: Abstract Data Types is a way to generalize/model software so that the same interface used with different implementations and types. Standard Template Library is a good example of Abstract Data Types. For example the interface for stack is independent of the implementation. Under the hood stack may be implemented by … | |
Re: [CODE] std::stringstream out; for(size_t i=0; i < size; i++) { int x = digit[i]; x = x >> i; // do something to digit out << x; } [/CODE] | |
Re: Objects and thread work together well. Try to model your problem in terms of classes. For example Shuttle can be designed as an active class | |
| |
Re: Comparing floating point numbers using == or != is not safe. The difference between the two numbers must be compared to some tolerance, usually the system epsilon. (see sample code below). [code] bool isEqual( float v1, float v2 ) { if( std::abs(v1-v2) < std::numeric_limits<float>::epsilon() ) { return true; } return … | |
Re: I would think a terminal condiion is needed, some way to end it all... | |
Re: Stuff is always hard at first... Take a stab at it, write some code to get started.. | |
Re: [CODE] bool isSame(double a, double b) { return std::fabs(a - b) < std::numeric_limits<double>::epsilon(); } [/CODE] | |
Re: 34 is the right answer two minus becomes plus [url]http://wiki.answers.com/Q/Do_a_minus_and_a_minus_make_a_plus[/url] | |
Re: max is most likely 2, because you must be passing 2 Code presented is incomplete, so its hard to figure out why. | |
Re: What is your intent of distance=0? You already initialized the contents of array. Seem like you can just remove that statement. [CODE] void Graph::initialize() { for(int i=0;i<numOfVertices;i++) { mark[i] = false; predecessor[i] = -1; distance[i] = INFINITY; } [B]distance = 0; //here is the problem...[/B] } [/CODE] | |
Re: If you are permitted to do so, you can perhaps load your text file into a std::set and use that as your dictionary. | |
| Re: Perhaps a custom sort on the vector might solve your problem. See attached link for ideas [url]http://stackoverflow.com/questions/1380463/sorting-a-vector-of-custom-objects[/url] |
Re: Do do not need to or want to put your executable in VC folder. set the path to location of dumpbin (there should be a batch file that sets this path) and run dumpbin on your executable where it is currently locationed | |
Re: Perhaps an expression evaluator such as below... [url]http://www.arstdesign.com/articles/expression_evaluation.html[/url] | |
Re: This is an observer pattern problem. [url]http://sourcemaking.com/design_patterns/observer[/url] Therefore you need an observer, which keeps a list of all dependents. When an update is received observer loops through and updates all dependents. Using one thread per client is not going to scale very well if you intent to have many chatters. … | |
Re: [url]http://linux.about.com/library/cmd/blcmdl1_md5sum.htm[/url] [url]http://www.gnupg.org/[/url] | |
Re: C++ does name mangling to ensure method/function names are unique, C does not. So when calling C function from C++ you need to let C++ know it’s a C function. This can be done using the extern "C", read below for examples [CODE] extern "C" { #include "header.h" } [/CODE] … | |
Re: try using gettimeofday, will give you usec rather than seconds sample code [url]http://www.daniweb.com/software-development/cpp/threads/361138[/url] | |
| |
Re: If you have a pointer to array, you can use it as an array... [CODE] int main() { int a[]={1,2,3}; int* p=a; int val=p[0]; } [/CODE] | |
Re: try it in c first, just for fun. Here is something to get you started, complete the function, use algorithm described by Narue.. [CODE] char *reverse( char *input) { } [/CODE] | |
Re: [CODE] struct timeval { unsigned long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ }; [/CODE] | |
Re: perhaps something like this [url]http://stackoverflow.com/questions/5265607/how-to-send-double-click-on-keyboard-focused-object-from-c[/url] | |
Re: Seems, fine, ensure you have the correct headers. [CODE] #include <vector> #include <string> int main() { std::vector<std::string> TexName; TexName.push_back("mega.png"); return 0; } [/CODE] | |
Re: What input sequence causes core dump? seems to work on my machine... | |
Re: 1. Allocation means to create space for your application use 2. Initialize means to assign specific values to that space Using malloc creates space, but contents of space undefined | |
Re: try [url]http://www.kernel.org/doc/man-pages/online/pages/man3/usleep.3.html[/url] | |
Hello Community, I am trying to figure a simple way approximate cost of context switching for a given OS/hardware combination under different loads. For example on my 2 GHz dual core MAC OSX, running single instance clocks at 0.5 usec where as three instance at 1.3 usec. Below is sample, … |