Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
81% Quality Score
Upvotes Received
10
Posts with Upvotes
9
Upvoting Members
6
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
2
2 Commented Posts
0 Endorsements
Ranked #914
~18.0K People Reached
Favorite Forums
Favorite Tags

48 Posted Topics

Member Avatar for thecoolman5

have a look at the boost Spirit library, there is an example where they do exactly that. basically you create a tree where operators are nodes and expressions subtrees with literals as leaves. It's a parse job of a Dyck-language basically (more or less). [url]http://www.boost.org/doc/libs/1_46_1/libs/spirit/doc/html/index.html[/url] Can't find the exact location …

Member Avatar for thecoolman5
0
220
Member Avatar for JordanHam

Yes it is possible. In fact the only justification for the continued existence of C++/CLI is that you can integrate standard C++. [EDIT] This is just my humble opinion. Why? If you want to use managed code then you are better off using C#, because it's syntactially simpler and spares …

Member Avatar for drkybelk
0
196
Member Avatar for watery87

You can't have a dynamic array. If you want to do that you need to use vector or use new/delete dynamic allocation. Space for arrays is reserved at compiletime so that's why you need a constant expression there.

Member Avatar for drkybelk
0
126
Member Avatar for sadsdw

[CODE] float **A = 0.0; // pointer for A [/CODE] You cannot do that. The initialisation takes a double calue (0.0) and tries to assign it to a pointer (A**) that is a type mismatch. use instead: [CODE] float **A = 0 /* or NULL, although some people frown upon …

Member Avatar for sadsdw
0
109
Member Avatar for sofiastrange

weeeeelll.... You are asking a bit much, coz writing a GUI depends entirely on the application and its requirement, but I will try to point you in a direction to get you started. MSVC uses "wizards" to create different kinds of projects. You must have used some already as you …

Member Avatar for drkybelk
0
277
Member Avatar for kutuup

All data in a digital computer is bits and bytes, effetively 0/1 strings. Datatypes of any sort are just interpretations of these data. Your job here is to serialise your object into a string of bytes before transmittions and recreate the object after it has been transmitted. Easiest to understand …

Member Avatar for kutuup
0
495
Member Avatar for Jimmyteoh

Converting from Java to C++ is not just a matter of translating the syntax from 1 language to the other, but also the use of corresponding libraries. GUI libraries in C++ are not standardised and therefore there won't be a standard translation of your code. Which operating system are you …

Member Avatar for Nick Evan
0
212
Member Avatar for sachintha81

probably this helps: [url]http://msdn.microsoft.com/en-us/library/ms724235(v=VS.85).aspx[/url] You should however very sparingly use recursion as a means of looping. Recursion can always be replaced by iteration which is much lighter on resources and also much easier to debug.

Member Avatar for drkybelk
0
371
Member Avatar for Billy D

for a start I am very curious about your system call there. You don't need it or you don't need your outf variable. Either the one or the other is superfluous. Since you run "whoami" probably get rid of outf. Are you running your program from the commandline? If so …

Member Avatar for TrustyTony
0
184
Member Avatar for miguelsan
Member Avatar for programing
Member Avatar for iamthesgt

You will have to create a string comparison function or better a functor (if you have yet learned what a functor/function object is). And you have to use that for doing your comparison and not the standard string comparison.

Member Avatar for drkybelk
0
218
Member Avatar for jowana

No. The gradient is the highest *CHANGE* in grey value. The maximum is what you want. Just initialise a variable maxval=0; then in a loop whenever you find a value > maxval then set it to the new maxval. Iterate through all greyvalues on your line. done. If however you …

Member Avatar for jowana
0
123
Member Avatar for gomezfx

Well there are a few things in your code that are a bit off. First: the sin function is a function that is usually defined on the real number range. You define the function on integers which is probably what you want, but I still wanted to point it out. …

Member Avatar for drkybelk
0
2K
Member Avatar for chess2009

How did you declare your variable temp? Since this->data and append.data have dynamic lengths your temp-variable needs to be allocated dynamically. [CODE] char * temp = new char[used+append.used]; [/CODE] Also this string then must be deleted somewhere [CODE] delete [] temp; [/CODE] also your function does not return anything, so …

Member Avatar for jonsca
0
116
Member Avatar for IndianaRonaldo

Read in from a file pairs of integer. Those N pairs represent 2D-vectors (in an XY- plane). Connect the vectors end-point of one connects to the startpoint of the next. Find the subset of size M<=N vectors that maximises the area this polygon encloses, if such a polygon exists. The …

Member Avatar for mrnutty
0
104
Member Avatar for Howdydoody

Your class DirectGraph has an overloaded [] operarator, but your variable directedGraph is a [B]pointer[/B] to a DirectGraph object. Your call should look something like: [CODE] (*directedGraph)[numSource]->adj.push_front(word); [/CODE] BTW: I see no good reason why you use a dynamically allocated object, but it's difficult to judge from the piece of …

Member Avatar for Howdydoody
0
108
Member Avatar for NinjaLink

How do you decide that a certain restriction is needed and another is not? It's not obvious from the query and that makes it difficult for any compiler do decide what can be optimised away and what not. Optimisations of queries are best done within the database. Most major DB …

Member Avatar for drkybelk
0
117
Member Avatar for NvIs
Member Avatar for livinFuture

C++ already provides you with the means to do that. [url]http://www.cppreference.com/wiki/io/io_flags?s[/url][]=hex

Member Avatar for WaltP
0
446
Member Avatar for jowana

Well first you need to be clear what you mean by "mean". The mean is like the average value of a number of values. In the easiest case that would be a simple vector of double values. One type of mean is the sum of all of those values divided …

Member Avatar for drkybelk
0
114
Member Avatar for kumarmpk4u

Microsoft has not the best record on backwards compatibility, but you should be able to compile an older project with a newer compiler without too much problem. Depending on the version of Visual Studio you should have a migration wizard. You should use that to migrate your project file to …

Member Avatar for drkybelk
0
515
Member Avatar for bleedsgreen33

I haven't looked too deeply into your code but at first glance there are a few things that are dangerous/undefined and wrong with your code. For a start: pointers in C++ (and C for that matter) are [B]not[/B] automatically set to NULL (0) when they are declared. They have an …

Member Avatar for drkybelk
0
84
Member Avatar for mclemon

For a start: it is no problem to create a vector of vectors which saves you naming each vector and instead use an index [CODE] typedef vector<vector<double> > DOUB_VEC_VEC; DOUB_VEC_VEC myVecs; myVecs.resize(3); // three vectors of doubles myVev[0].push_back(2.4); myVev[0].push_back(3.13); myVev[1].push_back(5.0); myVev[4].push_back(42.0); cout << myVec[0][1] << endl; // displays 3.13 [/CODE] …

Member Avatar for vijayan121
0
102
Member Avatar for duliduli556

look at [url]www.boost.org/doc[/url] there are already good smart-pointers with ref counting. No need to do the work yourself ;-)

Member Avatar for jonsca
0
80
Member Avatar for jackmaverick1

there are different scenarios for different purposes: [CODE] void f1(int i); // call by value void f2(int* i); // pointer void f3(int& i); // call by ref void f4(int** i); // pointer to a pointer void f5(int*& i); // pointer passed by ref void f6(const int i); // call by …

Member Avatar for gerard4143
0
135
Member Avatar for dospy

The main class object will be the last that is destroyed. That is not your problem. Your problem is that you did not create copy constructors and assignment operators. Whenever you have pointer-members in a class you should create default- and copy constructors, assignment and destructors. Your function [CODE]SecClass :: …

Member Avatar for dospy
0
181
Member Avatar for Sc@recrow

use the boost function boost::posix_time::ptime after = boost::posix_time::microsec_clock::local_time();

Member Avatar for rubberman
0
130
Member Avatar for opawix

if I understand properly you want to decrease the subtrahend by 3 every time and subtract it from your current result. To do that add another variable called subtrahend and initialise by 25. Each round of the loop decrease the subtrahend after you subtracted it from i. [CODE] #include<iostream> using …

Member Avatar for opawix
0
88
Member Avatar for loveranjan

Can you describe the problem you got? I think you have a serious problem, if I understand your code correctly. I haven't compiled or run it, but your nested class node will cause grief and bodily harm, I believe. A struct is exactly the same as a class in C++ …

Member Avatar for drkybelk
0
197
Member Avatar for winrycool1

The Sutter book is Excellent, Also you should look at his STL book (Exceptional STL, I think). The STL is the "way-to-do-things" nowadays and the earlier you get to grips with that the better. User-interfaces are not standardised so you need a platform specific book. Windows and POSIX - based …

Member Avatar for mike_2000_17
0
200
Member Avatar for margeaux54

Not sure you copied all the code but if your comment is all that is in the if else block then you got a syntax error: should be like [code] void menu(void) { char a; cout<<"(E/e) Encryption"<<endl; cout<<"(D/d) Decryption"<<endl; cout<< "(Q/q) Quit"<<endl; cout<<"Enter operation code :"; cin>>a; if ( a!='e' …

Member Avatar for margeaux54
0
187
Member Avatar for BenjyC

The first error comes from you having SavedClass as a parameter of [code] void LoadState(SavedClass &Save, long SavedLength, bool type); [/code] You might be able to get rid of this error by forward declaring class SavedClass. Add: [code] class SavedClass; [/code] before the definition of class InputClass and this error …

Member Avatar for BenjyC
0
180
Member Avatar for Fumomo

try the following: [code] std::map<string,int> dateValueMap; for(int i=0; i<arraysize; i++) { dateValueMap[array2[x][0]] += atoi(array2[x][1].c_str()); } // output sorted by date (lexicographically) for(std::map<string,int>::iterator mapIt = dateValueMap.begin(); mapIt != dateValueMap.end(); mapIt++) { cout << "date=" << mapIt->first << " value=" << mapIt->second << endl; } [/code] I haven't debugged it and so …

Member Avatar for drkybelk
0
125
Member Avatar for jfunchio

Well you are making a novice mistake her - not to worry - we all did. You should not overload the binary operators like +,-,==, and so on as [B]members[/B], but as [B]globals[/B] and make the global operators friends of the class if neccessary. The reason for this is that …

Member Avatar for Fbody
-3
249
Member Avatar for Ana_Developer

What is the response you are getting? I had a similar problem - I did not get a bad response - in fact the response string was telling me that I was connected. Turned out that the web-site I connected to used a cookie to maintain the session state. The …

Member Avatar for drkybelk
0
206
Member Avatar for Weird Nerd

right, there are some fundamental problems here: [code] int main(int argc, char *argv[]) { int *i; // pointer un-initialised - some random value in here // because i points to a random memory address the de-referencing will most likely // cause an unhandled exception on the print-out // if you're …

Member Avatar for ShadowScripter
0
149
Member Avatar for tomtetlaw

In a way that's the only way to read from disk. If you are interested in how to do file I/O manually then I suggest you get familiar with the C++ functions fput, fget, fseek, etc. If you are asking whether sth like double* pDbl can be made to point …

Member Avatar for Narue
0
119
Member Avatar for lochnessmonster

Well RAII stands for Resource Acquisition is Initialisation. And Yes you are are right in a way: The idea is to create the object that handles your resource and let its constructor handle the acquisition and the destructor handle the freeing of it. As you know all objects that are …

Member Avatar for drkybelk
0
71
Member Avatar for Tiny_trixer

you have to write your own operator for class Inputoutput: [code] ostream& operator << (ostream& os, const Inputoutput& io) { // here you have to implement how you want to output os << io.someMember << "," << io.anotherMember(); return os; } [/code] you might need to declare the new (global!) …

Member Avatar for drkybelk
0
138
Member Avatar for chamika.deshan

You can do exactly the same in C++: in test.h [code] class Test { public: static int myArray[10]; } [/code] in test.cpp [code] int Test::myArray[10] = {0}; // the = {0} is not neccessary, but good practice as it initialises the array with zeros [/code] You declare the array in …

Member Avatar for chamika.deshan
0
2K
Member Avatar for daviddoria

what is the definition of itk::RescaleIntensityImageFilter<typename T, typename T> ? Are you sure you can pass two parameters of the same type to this template?

Member Avatar for Fbody
0
4K
Member Avatar for techie1991

You're taking avery "last-century-C-like" approach here. Although it is good to know about malloc alloc, arrays and stuff the STL is a much better choice in most cases. since you already use the STL for your streams, you should also use vectors/maps/lists etc. Get used to them they'll save you …

Member Avatar for Fbody
0
216
Member Avatar for Neon_Jesus

Hi, you have to take your function definitions outside the main body. It looks a bit like java what you've done here. Inside the main loop you should *CALL* the functions you defined outside. [code] void greeting() { printf("\nThis Program will sort and seperate a list into primes.\n"); printf("You may …

Member Avatar for drkybelk
0
221
Member Avatar for qinise4

There are a few ways you can do that, obviously. First I'd examine the possibilty of restricting the size you need. questions to ask yourself: do I really need a full matrix? matrices can be sparse, diagonal, symmetric,.... if so: try to use specialised containers from e.g. boost ([url]www.boost.org[/url]) If …

Member Avatar for qinise4
0
2K
Member Avatar for myk45

What kind of analysis do you want? You know that you will need 3 loops for arbitrary matrices (unless you use the fast algorithm, which saves on the loops in favour of caching some values and re-ordering the calculations). If you have constant matrix-dimensions then you can hardcode away the …

Member Avatar for myk45
0
131
Member Avatar for genext.brite

This is a prime example of "write-only-code" and whoever wrote it should be shot on the spot. I executed the code on VS2010 and wrote an if-cascade that does the same (on this compiler) [code] i=-1; j=0; k=0; l=2; m=0; if(i&&j) { if(j&&k) { m=1; } k++; } i++; j++; …

Member Avatar for arkoenig
-5
171
Member Avatar for emybob

[code] #include <time.h> // for time(NULL) #include <vector> #include <iostream> #include <algorithm> using namespace std; srand(time(NULL)); // seed the random number generator vector<bool> field; field.resize(400); // == 20 x 20 for(int i=0;i<5; i++) field[i] = true; // the rest are all false already random_shuffle(field.begin(),field.end()); // now the 5 x-s (true) …

Member Avatar for emybob
0
122

The End.