5,237 Posted Topics

Member Avatar for parthiban

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]

Member Avatar for parthiban
0
127
Member Avatar for jaepi

> 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 …

Member Avatar for jaepi
0
126
Member Avatar for squinx22

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.

Member Avatar for Salem
0
67
Member Avatar for bassem

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? …

Member Avatar for mathematician
0
120
Member Avatar for stupidenator

Read about "@*" in the perlform manual page. [URL]http://perldoc.perl.org/perlform.html[/URL]

Member Avatar for KevinADC
0
142
Member Avatar for Ahmed Padela

>[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.

Member Avatar for Ahmed Padela
0
215
Member Avatar for Matt Tacular

> 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 …

Member Avatar for Matt Tacular
0
242
Member Avatar for m.s

> 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 …

Member Avatar for m.s
0
199
Member Avatar for rapperhuj

So do like it asks and run it as super user - isn't the error message that obvious?

Member Avatar for Salem
0
136
Member Avatar for radskate360

> 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] …

Member Avatar for iamthwee
0
283
Member Avatar for bcramer

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 …

Member Avatar for Salem
0
113
Member Avatar for jerryseinfeld

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.

Member Avatar for Salem
0
81
Member Avatar for Salem

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] :(

Member Avatar for The Dude
0
148
Member Avatar for pavani2006

Also here on the C forum as well. [url]http://www.daniweb.com/techtalkforums/thread78758.html[/url]

Member Avatar for Salem
0
323
Member Avatar for IwalkAlone

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 …

Member Avatar for ~s.o.s~
0
143
Member Avatar for CRD

1. Delete that #include line 2. Somewhere in project settings, compiler, pre-processor(?), there is an option for "precompiled headers". Turn that option off.

Member Avatar for CRD
0
80
Member Avatar for snickers6226

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.

Member Avatar for Salem
0
94
Member Avatar for jaepi

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.

Member Avatar for Salem
0
117
Member Avatar for ndeniche

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 …

Member Avatar for ndeniche
0
504
Member Avatar for JaksLax

> 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

Member Avatar for Salem
0
145
Member Avatar for venuaccha

> 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 …

Member Avatar for Salem
0
838
Member Avatar for ashkash
Member Avatar for squinx22

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 …

Member Avatar for ndeniche
0
93
Member Avatar for therwi

An easy implementation of a stack is simply an array which you only access at one end.

Member Avatar for qrius
0
122
Member Avatar for ghadahelal

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?

Member Avatar for ghadahelal
0
110
Member Avatar for IwalkAlone

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.

Member Avatar for Salem
0
120
Member Avatar for laconstantine
Member Avatar for parthiban

> 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 …

Member Avatar for parthiban
0
119
Member Avatar for louis7370

> 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 …

Member Avatar for Salem
0
138
Member Avatar for brightmohan

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]

Member Avatar for Salem
0
101
Member Avatar for nkhosinathie

It's also cross-posted here as well. [url]http://www.daniweb.com/techtalkforums/thread78186.html[/url]

Member Avatar for Aia
0
135
Member Avatar for the juice

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 …

Member Avatar for Salem
0
772
Member Avatar for Zillian
Member Avatar for nineball_ssj9

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 …

Member Avatar for nineball_ssj9
0
98
Member Avatar for moon309

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)

Member Avatar for Salem
0
66
Member Avatar for learningtocode

Read this [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Then edit your post.

Member Avatar for Salem
0
266
Member Avatar for rati

strstr() is just strncmp() and a for loop. strncmp(&haystack[0],needle,strlen(needle)) strncmp(&haystack[1],needle,strlen(needle)) and so on

Member Avatar for rati
0
105
Member Avatar for EnderX

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 …

Member Avatar for EnderX
0
154
Member Avatar for laconstantine
Member Avatar for eeeraser

Indispensable reading. [url]http://www.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/files.html[/url] Int 16/AH=01h perhaps.

Member Avatar for eeeraser
0
3K
Member Avatar for stol3n

> 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 …

Member Avatar for ebmusicman
0
123
Member Avatar for generalGOTCHA
Member Avatar for Radons

> 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 …

Member Avatar for Radons
0
227
Member Avatar for Eleventeen

> BRz NEXT ; not uppercase, get next So try 'not zero' branch then lower case characters have bit 6 set (not clear)

Member Avatar for Eleventeen
0
464
Member Avatar for anw

> 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 …

Member Avatar for Salem
0
111
Member Avatar for eeeraser
Member Avatar for Salem
0
310
Member Avatar for brightmohan

> 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 …

Member Avatar for brightmohan
0
388
Member Avatar for cjwenigma

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.

Member Avatar for Ancient Dragon
0
82
Member Avatar for amrbekhit

Maybe because PC is already pointing at the first byte of the next instruction, rather than the last data byte of the JMP instruction.

Member Avatar for Colin Mac
0
184
Member Avatar for sushanttambare

[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.

Member Avatar for Infarction
0
116

The End.