447 Posted Topics
Re: Uh.... what? | |
Re: Best worry about that 'useless junk' when you need to. | |
![]() | Re: I'd say the easiest way to do it would be to do something like[code]<form method="post" enctype="multipart/form data" action="submit.php"> <select name="one" onChange="submit('one')"> <option value="1">1st choice</option> <option value="2">2nd choice</option> </select> <select name="two" onChange="submit('two')"> <option value="1">1st choice</option> <option value="2">2nd choice</option> </select> </form>[/code]And then add the [inlinecode]?source=one/two[/inlinecode] as you described. The string one and … |
Re: Well. If it's the digits you're interested in you need only do:[code]lint main( int argc, char *argv[] ) { long num = 123; int dig1 = num % 10; int dig2 = (num/10) % 10; int dig3 = (num/100) % 10; printf( "%ld = %d %d %d\n", num, dig3, dig2, … | |
Re: If you want a 2d vector you can do something like: [code=cpp]#include <iostream> #include <vector> // These just make the notation used in the program easier typedef std::vector<float> xVec; typedef std::vector<xVec> xyVec; int main( int argc, char *argv[] ) { // Define the x and y dimensions and the initial … | |
Re: It might have something to do with [inlinecode]while (nullexists = true)[/inlinecode]. Do you mean [inlinecode]==[/inlinecode]? | |
Re: You misunderstand. It's -- [icode]static ExternalInputs_test2_2 test2_2_U;[/icode] For non-pointers you use the . operator. Not ->. Try replacing -> with . | |
Re: [inlinecode]cin.ignore()[/inlinecode] I think. | |
| |
Re: >> sizeof( any pointer ) is always the same >> That happens to be true for the garden variety PC of today, but it is not true as a generic statement. Also, on the same system fat pointers are bigger than normal pointers... [url]http://en.wikipedia.org/wiki/Function_pointer#Method_pointers[/url] | |
Re: You can only use that if you're assigning when defining, i.e.[code]int thing[] = { 4, 8, 15, 16, 23, 42 };[/code]If you're not assigning you must use a constant size. Alternatives. Use pointers and dynamically allocate a size you want. Use scalable array containers, like vectors, list or maps. | |
Re: You have two options, really. You can either pass in a pointer to char the pointer that you're passing in, or you can return the allocated array, or indeed both, if you really wanted. So... [code]//... char *Test1(int *sizeptr){ char *text = malloc( *sizeptr ); // ... return text; } … | |
Re: As far as I remember multiplication in the frequency domain is more efficient than convolution in the time domain, so fft the signals and multiply 'em out. Also, if you're doing a PhD in physics I'd assume that you'd have access to mathematically orientated software. This is much more easily … | |
Re: Does the second program have to do the same thing as the first but must be written differently? You could always do a switch on [inlinecode]readValue[/inlinecode] instead of the if tree. | |
Re: And what errors are you getting? | |
Re: Looks good. Have you considered negative bases, for fullness? | |
Re: I assume it's talking about the assignment of [inlinecode]pos=wordlist.begin()[/inlinecode]. If so you'd imagine that wordlist isn't of type [inlinecode]map<string,unsigned>[/inlinecode] from what the error says. Can you post more code so we can see more of what you're doing? | |
Re: I'm no assembly guru, but you might be able to find something were you to decompile it. | |
Re: Well... were you to decompile to hex and then recompile from modified hex you might be able to squander something... don't know if it'd work, though. Especially if the program depends on libraries and such. For a really simple [code]int main() { printf( "1" ); return 0; }[/code]you might be … | |
Re: Show us some code I suppose. You should know how deep each element is, and you can use the debth to see how many spaces are needed I think it'd make sense to print the data to a string, I'd say. | |
Re: Hmm. Can you show us your file? Don't forget to [inlinecode]delete []floatArray;[/inlinecode] | |
![]() | |
Re: I read none of the replies but I find it so bloody frustrating when I watch a game of football (soccer). The players get paid more than I have probably earned in my lifetime every week and yet they can't stay on their damned feet! Can't they just play the … | |
Re: Read here [url]http://www.adrianxw.dk/SoftwareSite/FindFirstFile/FindFirstFile1.html[/url] (and part 2 and 3), and in the retrieving loop you could simply have a counter that's returned by the function. | |
Re: About the spaces it might be worth making a string to do them rather than looping: [code=cpp]#include <iostream> #include <string> int main( void ) { std::string spaces( 10, ' ' ); std::cout<< '#' << spaces << "#\n"; return 0; }[/code] *checks OP's restrictions* | |
Re: I doubt you'll get any code for free here. So here's an outline of how you might go about it. Grab the input from the user and compare strcmp() it against references, i.e. "January", etc (might want to consider how you'd work with upper and lower case letters). Then grab … | |
Re: All that changes with iterators that aren't 'int's is the template argument. [url]http://www.cplusplus.com/reference/stl/vector/erase/[/url] [code]std::vector<randomType> myVec; // Fill the vector with something std::vector<randomType>::iterator iter; // const_iterator if you aren't gonna be modifying anything iter = myVec.begin(); // Points to the first element myVec.erase( iter ); // Will delete the first element … | |
Re: Most things can be divided. Do you mean is divided with no remainder? The modulus operator is your friend here. [code]for ( i=0; i<10; i++ ) { printf( "%d mod 4 = ", i, i%4 ); }[/code]It returns 0 if no remainder would be returned on division. | |
Re: That's curious. Try doing \r\n instead. Not sure if that'll help, to be honest, but worth a try. Can you get a hex editor and look at the hex of the file and see if the \n character is there? It could just be your editor. | |
Re: [url]http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx[/url] | |
Re: Hmm. Hard to say without seeing code, really. You could always [inlinecode]using namespace namespaceOne::namespaceTwo;[/inlinecode] if you wanted to hide the thing. | |
Re: >> My question is how can I use a member function of C at D and at D's child classes? I don't understand that sentence. Can you elaborate or show what you mean with a simple example that shows what you want to do even if it doesn't work? | |
Re: Someone asked something similar before in [URL="http://cboard.cprogramming.com/cplusplus-programming/107469-custom-loose-coupling-string.html"]another forum[/URL] and you could do something like this.[code=c++]class thing { private: typedef int (*_fptr)(int,int); // Typedef this for readibility of functino pointer std::map<std::string, _fptr> mfp; // Associate a string to a function pointer public: void add( std::string id, _fptr f ) { mfp[id] … | |
Re: You could have it so the constructor requires a flag to ID the allocated item... so something like...[code]class base { public: enum derrivableIDs { idBase, idOne, idTwo }; protected: derrivableIDs id; public: base() : id(idBase) { } derrivableIDs getID( void ) { return id; } }; class one : public … | |
![]() | Re: Curious. You should use [inlinecode]std::string[/inlinecode]s really...[code]std::string strItoA(int number) { std::ostringstream sin; sin << number; return sin.str(); }[/code]Though Narue may tell you to [URL="http://cboard.cprogramming.com/cplusplus-programming/82479-opposite-atoi.html#post586132"]generalise[/URL] (which is a good idea, even though she spells it wrong ;)) which is where templates become your friend. ![]() |
Re: Check your last thread! [url]http://www.daniweb.com/forums/post936815.html#post936815[/url] | |
Re: No. Everyone thinks the one they use is the best. Do something that makes sense. Nobody will complain too much so long as it's sensible. | |
Re: [url]http://www.sqlite.org/[/url] Never used it, but have heard people speak good about it. | |
Re: Haven't done template programming in a while, but as far as I remember you only need to specialise a function rather than the entire class. I think this should work, if not it should give you a good idea how to do what you want...[code=c++]template <typename ty> class thing { … | |
Re: First consider not globalising all the variables and consider passing them by pointer or something from main(). Second, the line should be stringarray[j][0] = string[j]; That should be it, methinks. Work on indentation too, perhaps. | |
Re: I'd imagine if you were to wait in the for loop for about a second per iteration it'd be different. The problem is that you're reseeding the rand function so quickly it's being reseeded off the same value. You only need to seed it once, so do it at the … | |
Re: You should read about getline here, [url]http://www.cplusplus.com/reference/iostream/istream/getline/[/url] Personally, I'd use std::string-s and getline... [code=cpp]#include <string> #include <fstream> #include <iostream> int main() { std::ifstream inFileStream( "filename.txt" ); std::string line, file; while( std::getline(inFileStream,line) ) file += line + "\n"; std::cout<< file; return 0; }[/code] ![]() | |
Re: [url]http://www.codeguru.com/forum/showthread.php?t=302806[/url] First hit on google. Basically, it extracts segments from a varaible, i.e. the higher or lower 16 bits. | |
Re: Well. I haven't read the rest of these pages but I don't think I could stand dating someone who didn't interest me intellectually. I would definitely get bored after a week (from experience). Without a doubt personality/intelligence would be near the top of my 'list', while looks do not hold … | |
Re: In terms of education, healthcare etc I don't think anyone can really have an educated view on this unless they lived in both nations for long enough period, say about ten years. In both cases the decision would be a 'lesser of two evils' answer -- none are perfect. You … | |
Re: [inlinecode]unsigned int val = (unsigned int)array[0]; // For the value 1[/inlinecode] |
The End.