5,237 Posted Topics
Re: The cast is in the wrong place. The sub-expression 9/5 has already happened, and produced an integer result, before the cast happens. Why not just remove it and type [inlinecode] celsius * 9.0f / 5.0f + 32.0f;[/inlinecode] | |
Re: > I've been studying c++ for about a month. I would suggest you need at least 6 months (or maybe a year) to get really good at C++ before you start making a mess of things with threads. [URL]http://www.kuro5hin.org/?op=displaystory;sid=2002/11/18/22112/860[/URL] If it takes you a few days to find an obscure … | |
Re: So have you made any progress by reading the manual? [url]http://www.gnu.org/software/make/make.html[/url] Your description is unclear. From what you're asking, I would think a shell script would be more appropriate than a makefile. | |
Re: Does it assemble? If not, what error messages do you get, which assembler are you using? Does it run? Do you run it by double-clicking on the executable (does the DOS box disappear before you get a chance to read anything), or do you run it from a command prompt? … | |
Re: Read about "@*" in the perlform manual page. [URL]http://perldoc.perl.org/perlform.html[/URL] | |
Re: >[INLINECODE]sum1+=a[i][j];[/INLINECODE] What is the value of j all through the loops of this line of code? Perhaps [INLINECODE]sum1+=a[i][i];[/INLINECODE] The same kind of argument can be made for the other loop. | |
Re: > phrase1 = 'There is'; This needs to be a std::string, not a single char. Then you'll be able to write [INLINECODE] phrase1 = "There is"; // note double quotes "", not single ''[/INLINECODE] > << (Cat::HowManyCats == 1 ? "is " : "are " While this seems like a … | |
Re: > I can see there are many errors showing in the compiler, > but whenever I try to fix the remaining errors, more appear! Always start with the first one in the list. Everything else in the list can be a consequence of the compiler trying to make a guess … | |
Re: So do like it asks and run it as super user - isn't the error message that obvious? | |
Re: > char shape, dumbell, axle, spear; Make this [inlinecode] std::string shape;[/inlinecode] Plus, you don't need those other 3 anymore than you need a variable called banana in order to hold the string "banana". [inlinecode] std::string fruit = "banana"; // pedants feel free to point out that banana is a herb[/inlinecode] … ![]() | |
Re: The memory is freed, it's just not given back to the OS. This is so you can allocate and free memory through the life of the program without going to the hassle of asking the OS each time you want some more memory. If you repeat the allocation, then your … | |
Re: Choosing some more meaningful variable names rather than xxx yyy zzz etc would probably tell you a lot. xxx / yyy is pretty meaningless, but if you had something like apples / oranges, it becomes pretty darn obvious very quickly that it is a completely stupid thing to even try. | |
You can mark every single forum as read, at the [B]bottom [/B]of [url]http://www.daniweb.com/techtalkforums/index.php[/url] You can mark an individual forum as read, at the [B]top [/B]of [url]http://www.daniweb.com/techtalkforums/forum8.html[/url] But there doesn't seem to be a quick way of marking a forum group as read. [url]http://www.daniweb.com/techtalkforums/forum2.html[/url] :( | |
Re: Also here on the C forum as well. [url]http://www.daniweb.com/techtalkforums/thread78758.html[/url] | |
Re: Why does reverse return anything anyway - it's no use just printing a char. You're reversing a string "in place", so the real answer is in string. printf("%s",string); [code] if ( length > 1 ) { ptr[0]=ptr[length-1]; reverse(ptr+1,length-2); } [/code] Is a closer answer which might give you the clue … | |
Re: 1. Delete that #include line 2. Somewhere in project settings, compiler, pre-processor(?), there is an option for "precompiled headers". Turn that option off. | |
Re: Does C:\Dev-Cpp\bin\ld.exe even exist on your machine? > Building Makefile:"C:\Dev-Cpp\Projects\Makefile.win" Or maybe you've trashed the install by writing your projects inside the install directory structure. Once you've installed it, you should regard the whole of C:\Dev-Cpp as read-only. All your work should be in say C:\Projects for example. | |
Re: It really doesn't matter what the extension is, you still have to validate its content. You malicious (or curious) user might just decide to try to rename foo.jpg to foo.iso just to see what happens. | |
Re: Most of them can't even use code tags properly, despite water marks in edit windows, and sticky threads with titles like "new posters, read this first". Still others seem to click on "solved" even when it isn't (I've just seen this scenario on the asm board). Nor does marking it … | |
Re: > Partition (A, F, L); This returns a value, which you ignore. > QuickSort (A, F, PivotIndex-1); This uses a value of PivotIndex, which is uninitialised. > InsertionSort (A, L); Here you try to sort the whole array, not just a fragment from F to L | |
Re: > void foo(int array[10][]) Should be void foo(int array[][10]) It's only the left-most dimension which can be left empty. > void foo(int **array) Whilst this does allow variability, it doesn't allow you to do[code]int small[10][10]; int large[100][100]; foo( small ); foo( large ); [/code] There is no good way to … | |
Re: If you're doing this (putting your own header files in /usr/include) just to avoid having to specify -I parameters on the compiler command line, then you need to reconsider your approach. Polluting /usr/include with a bunch of project specific header files will surely come unstuck in a big way at … | |
Re: An easy implementation of a stack is simply an array which you only access at one end. | |
Re: Discover the magic of code tags. [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Don't you see the watermark at the back of the edit window, or are you just ignoring it? | |
Re: Your average is going to change each time around the loop. Maybe one loop to calculate the sum, then calculate the average for the whole array (once), then another loop for the lesser, greater counts. | |
| |
Re: > Please tell me how it is possible ? You're returning a pointer to a local variable. So when the function returns, the local variable disappears, and the pointer is invalid. Note that this does NOT GUARANTEE that your code will break. With undefined behaviour, absolutely anything can happen, including … | |
Re: > while(!suppauto1.eof()) 1. You shouldn't use eof() in a while loop. You need to test the result of the read function itself. 2. The read function (being in the loop) reads to the same data area each time, so at best you end up with just the last record of … | |
Re: This might be a bit advanced for your fossil DOS compiler, but your Linux compiler will have no problems. ANSI-C introduced structure assignments, so your swap can be reduced to. [code] struct book temp = cat[b]; cat[b] = cat[b+1]; cat[b+1] = temp; [/code] | |
Re: It's also cross-posted here as well. [url]http://www.daniweb.com/techtalkforums/thread78186.html[/url] | |
Re: Also, 90% of your code has nothing to do with the problem at hand, it's just user interface fluff. [code=c] void encryptIt( const char *clear, char *cypher ); int main ( ) { char cleartext[] = "WE ARE DISCOVERED. FLEE AT ONCE"; char cyphertext[100]; encryptIt( cleartext, cyphertext ); printf("%s\n", cyphertext … | |
Re: What happened to the indentation of your code? | |
Re: So which bit is bugging you? Reading in two numbers? Counting between them? Calling a function? Getting the result from a function? Working out if a number is divisible by 4? If you post some effort showing what you can achieve, then ask a specific question about what to do … | |
Re: Show some effort [url]http://www.daniweb.com/techtalkforums/announcement125-2.html[/url] Don't forget the code tags (that would be the link below) | |
Re: Read this [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Then edit your post. | |
Re: strstr() is just strncmp() and a for loop. strncmp(&haystack[0],needle,strlen(needle)) strncmp(&haystack[1],needle,strlen(needle)) and so on | |
Re: Well searching for "bht scanner" shows that it looks like it is a manufacturer and/or model number for a particular scanner. My guess is that the .h / .lib file were provided as part of some SDK with the scanner itself. Perhaps contact the scanner manufacturer to see if they … | |
Re: Indispensable reading. [url]http://www.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/files.html[/url] Int 16/AH=01h perhaps. | |
Re: > it keeps on insisiting that i have invalid types of data. I'm guessing the problem is in the way you're trying to pass an array to a function. A prototype of [INLINECODE]void initialiseBoard(char [COLOR="red"]array[/COLOR][ROW][COL]);[/INLINECODE] Needs [INLINECODE]char array[ROW][COL];[/INLINECODE] You can name it whatever you want, but the dimensions need to … | |
| |
Re: > 00 00 06 34 (Should be 1588) But 34 06 00 00 is 872808448 In other words, the order is completely reversed. [url]http://en.wikipedia.org/wiki/Endian[/url] If you're trying to read a binary value from a file, and the endian of your machine is different to the endian of the machine which … | |
Re: > BRz NEXT ; not uppercase, get next So try 'not zero' branch then lower case characters have bit 6 set (not clear) | |
Re: > Here's the compile line, with all make substitutions done: Is that what doing "gcc -v" told you? I'm at least a little suspicious about whether ~ expansions work or not in this context. Also, why are you using gcc to compile C++? The usual method would be to use … | |
Re: [url]http://en.wikipedia.org/wiki/Bresenham%27s_line_drawing_algorithm[/url] | |
Re: > Gosh! Nope! It still doesnt work.....The interpreter jumps at fgets() I dunno why. You're mixing a whole bunch of input styles. In particular, note that scanf() almost always leaves a \n behind, so anything else which uses \n to terminate input (your getline for example, or fgets()) will appear … | |
Re: I think you're supposed to output say [COLOR="red"]0x63[/COLOR] or [COLOR="blue"]63h[/COLOR] or some other variation to indicate that the representation is hexadecimal. | |
![]() | Re: Maybe because PC is already pointing at the first byte of the next instruction, rather than the last data byte of the JMP instruction. |
Re: [URL="http://www.prism.uvsq.fr/~cedb/local_copies/lee.html"]click me[/URL] Write clear code, use the best algorithms and data structures for the problem (do some research) and profile your code to find out where the real issues are. And leave all the low level micro-optimisation bit magic to the compiler. |
The End.