5,237 Posted Topics

Member Avatar for VinC

> gives me the correct output but why is this? Because scanf() is full of wonderful surprises - the most usual being that it leaves the \n on the input stream - just ready for the getchar() to return with immediate success. I'd suggest you ALWAYS use fgets() to read …

Member Avatar for Bench
0
426
Member Avatar for kimw

> and my source file is in the same folder as boost. This is a mistake - don't put your code in the same place as third-party libraries. In essence, you should have gcc -I/path/to/boost prog.c Where /path/to/boost is the top-level directory of where your boost header files are installed …

Member Avatar for Salem
0
230
Member Avatar for ravi_forum

In an equally pointless vein [code] // a = a + b while ( b-- ) a++;[/code] OK, so there are some side effects, and a bug or two ;) > I wanted to know the C Statement for adding two numbers without using + sign.. Study what exclusive-or and …

Member Avatar for Salem
0
190
Member Avatar for brianotieno

Read this, then edit your code to make it presentable [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] You didn't actually ask a question, nor make any suggestion as to what you think is wrong with the code (or the symptoms you get when you do run the code). Just dumping the code on a message board, …

Member Avatar for Dave Sinkula
0
335
Member Avatar for brianotieno

There's no need to spam the board either :( [url]http://www.daniweb.com/techtalkforums/thread53563.html[/url]

Member Avatar for Dave Sinkula
0
235
Member Avatar for JW1873

> Thank you so much i actually wasn't to far away with some of the answers, OK, so next time don't look like a complete and utter leech and actually post what you think the answers are rather than just dump your homework and hope you strike it lucky (and …

Member Avatar for mostafadotnet
0
250
Member Avatar for ishwar

> It works now, You mean "It works [U]for[/U] now" > I type casted the str2.substr(). If you needed a cast to get out of such a small problem, then you've almost certainly done the wrong thing and you're in for problems later on.

Member Avatar for ishwar
0
22K
Member Avatar for scoobie

> printf( "%d%s%s%s%d%s%s%s%d\n", index, delim, deltime, delim, type, delim, filename, delim, filesize ); Something like [code] FILE *fp = fopen( "file.csv", "w" ); fprintf( fp, "%d%s%s%s%d%s%s%s%d\n", index, delim, deltime, delim, type, delim, filename, delim, filesize ); fclose( fp ); [/code]

Member Avatar for Salem
0
124
Member Avatar for himanjim

Congratulations on finding a [URL="http://en.wikipedia.org/wiki/Quine"]Quine[/URL]. Just substiute for readability [code] printf( "char*str=%c%c%c;main(){printf(str,34,str,34);}", // str, 34, "char*str=%c%c%c;main(){printf(str,34,str,34);}", // str, 34 ); [/code] The first one contains 3 % conversions for the 3 params which follow The second one is just a string which happens to contain % characters The 'magic' is …

Member Avatar for Ancient Dragon
0
246
Member Avatar for degamer106

> is an assignment like fn4[23] = fn3[5] invalid? Well it's fine as far as the syntax is concerned. However, the pointer inside the structure presents big problems. [code] fn1.y = malloc( 10 * sizeof *fn1.y ); fn2 = fn1; free( fn1.y ); // fn2.y is now a dangling pointer. …

Member Avatar for himanjim
0
141
Member Avatar for Gunner54

> Just ignore that one -- it only means your program failed to compile and link correctly ROFLMAO - good one. It's like trying to explain fire to a caveman. It doesn't matter what you say, all they can do is "oooh" at the pretty colours and "argh" when they …

Member Avatar for Gunner54
0
815
Member Avatar for happy8899
Member Avatar for happy8899
0
2K
Member Avatar for himanjim

> while((i=fgetc(ptr))!=Null) As well as the EOF thing, i should be an int, not a char. It needs to be capable of storing all 256 possible values of char AND EOF (257 different values in total).

Member Avatar for Salem
0
166
Member Avatar for comp_sci11

> new is a keyword which cant be used as a variable True, but this is C, so it's OK. There's some good stuff in there ~s.o.s~ Here's some more for the OP to think about. > while(new->cus_ac_no > p->cus_ac_no You're comparing two pointers here, not two values. In general, …

Member Avatar for Salem
0
312
Member Avatar for himanjim
Member Avatar for grunge man

> int taco,pizza,chicken,hamburger,hotdog,; Does this even compile? That trailing , looks like a syntax error to me. > the only thing i can think of is that there might be something wrong with the compiler. Er, no - it's all your code. The chance of a newbie stumbling on a …

Member Avatar for ~s.o.s~
0
106
Member Avatar for amelie

[URL="http://cf31.clusty.com/search?v%3afile=viv_505%4031%3alVNcqL&v%3aframe=list&v%3astate=root%7cN865&id=N865&action=list"]click me[/URL] My guess is you tried to pass a C++ function as a "pointer to function" which is expecting a pointer to a C function. Perhaps some of the links will have more ideas, I didn't read them all.

Member Avatar for Salem
0
119
Member Avatar for gege1

Yes, it's the Fibonacci series [url]http://en.wikipedia.org/wiki/Fibonacci_number[/url] Read this first [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] Then post your attempt at a solution, then we can offer some useful suggestions on how to proceed.

Member Avatar for Salem
0
111
Member Avatar for dannyfang

As if bumping an old thread wasn't bad enough, you had to use gets() and atoi() to do it.

Member Avatar for Dave Sinkula
0
334
Member Avatar for tln26

> I am not sure the formula for average here Elementary maths perhaps? You add up all the elements in your array - use a for loop You divide the total by how many elements there are

Member Avatar for tln26
0
122
Member Avatar for joshilay

Like [inlinecode]3 = myVariable;[/inlinecode] Will generate an lvalue error, because you can't assign to a numeric constant. You can't assign to a function, or assign to an array either.

Member Avatar for himanjim
0
174
Member Avatar for tln26

> cout<<endl Until you fix ALL the compilation errors, you cannot debug your program. Also, you use /n where you probably mean \n

Member Avatar for Salem
-1
243
Member Avatar for SHWOO

> but the 19.95 and 246.50 display 0.00 Perhaps it's because of this bizarre line of code > bookPrice = ( price > 0.00 ) ? 0.00 : price; If the price is greater that zero, set it to zero.

Member Avatar for Salem
0
241
Member Avatar for tln26

> I keep getting a message that there is not an exe. file. What is causing this? Exact details please, not some vague "there's an error". This means - State your OS and compiler, with versions (not just windows and borland say) - An example simple program which shows the …

Member Avatar for Grunt
0
300
Member Avatar for cezarjont

[url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url]

Member Avatar for cezarjont
0
928
Member Avatar for himanjim

> actually leads to the assignment of value at s2 to s1 Yes, s2 is dereferenced to yeild a value, and that value is stored to where s1 points. > followed by incrementation of s2 then the incrementation of s1. That's less clear [url]http://c-faq.com/expr/seqpoints.html[/url] Which order they happen in, and …

Member Avatar for ~s.o.s~
0
244
Member Avatar for anu_dinoo
Member Avatar for bharat.bhooshan

> int **EL= (int**)malloc(row*col*sizeof(int) + col*sizeof(int*)); 1. You didn't include stdlib.h 2. Since this seems to be C++, you should be using new anyway. 3. Since your sizes seem to be constant, why are you dynamically allocating anyway? I see that lot adds up to at least a couple of …

Member Avatar for Salem
0
194
Member Avatar for star22
Member Avatar for Dave Sinkula
0
214
Member Avatar for Eddy Dean

> It never outputs that the startup has failed, so I don't believe that's the problem... I bet the following call to cleanup() before you get to do any real work has something to do with it.

Member Avatar for Eddy Dean
0
1K
Member Avatar for proteusx

[code] char* query = "SELECT %s FROM Table"; char newquery[100]; char* repl_val = "VariableFieldName"; sprintf( newquery, query, repl_value ); [/code] Any particular reason why you can't do this?

Member Avatar for proteusx
0
443
Member Avatar for s_nagula

More like the same message is spammed in many different forums (too many to remember, let alone revisit), so they're just sat there waiting for the inbox to magically reveal someone who will send them an answer. Of course, once you do this, they will attach themselves in some leech-like …

Member Avatar for Ancient Dragon
-1
133
Member Avatar for dev.cplusplus

> I was wandering is linked list the best solution? There isn't a "best" solution as such, there are many tradeoffs to be considered. Some of which are not so obvious. Well the search/replace is going to be expensive on larger lists, but that has to be weighed against the …

Member Avatar for Laiq Ahmed
0
459
Member Avatar for Gunner54

> Same Error's Just Fractionaly Diffrent Please stop capitalising every initial letter of every word. [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url]

Member Avatar for Dave Sinkula
0
582
Member Avatar for joshilay

> what are the features of c which are not available in c++ ??? C++ is a semantic superset of C. That is, everything you can do in C you can also do in C++. C++ is NOT a syntactic superset of C. That is, you can't take every C …

Member Avatar for Dave Sinkula
0
605
Member Avatar for newbie2k6

State your OS / Compiler, and what you tried to do, and say what you don't like about your current approach.

Member Avatar for b2daj
0
79
Member Avatar for Laiq Ahmed

What happens if the same word appears on a single line more than once? You could try [inlinecode]map<string,vector<int> >[/inlinecode] to associate a word with a list of line numbers.

Member Avatar for Micko
0
93
Member Avatar for Treant

1. Your class it at least missing it's closing ; 2. By failing to use code tags, certain class member functions have been replaced by smilies. 3. Why on earth are you still using char* to store strings. This is C++, and you already include <string>, so why not just …

Member Avatar for Salem
0
110
Member Avatar for Miles Archer

> #include "stdafx.h" Delete this from the project and disable "Use precompiled headers" in the microsoft compiler. > #include <malloc.h> This is an obsolete file, you don't need this. malloc etc are declared in stdlib.h You're also missing stdio.h and string.h > (69) : error C2664: 'FindFirstFileW' : cannot convert …

Member Avatar for Salem
1
344
Member Avatar for cyan033

> char *bin; Listen to the people - you need to allocate some memory. You can't just declare a pointer and assume you have an infintely long string you can play with at will. This is just some random location in memory. Start with [inlinecode]char bin[100] = { 0 };[/inlinecode]

Member Avatar for dwks
0
146
Member Avatar for Vickyy

"Threepio! Shut down all the garbage mashers on the detention level! Shut down all the garbage mashers on the detention level!" Here's a project for someone. "close thread where title is matched by "project" and age is greater than 3 months". That should slow down the "me too" brigade from …

Member Avatar for Bharati Krishna
1
479
Member Avatar for sgriffiths

> char *second=string2(string2,"|"); Huh - did you mean strtok() Also, you're not calling strtok() correctly either. You can't strtok() two strings at the [u]same time[/u]. Remember that NULL parameter means use where you got to last time. So you must get to the end of the first string before trying …

Member Avatar for jim mcnamara
0
236
Member Avatar for Shital Parab

> How to swap two variables without using a third variable & pointer? This ceased to be interesting when we came down from the trees and started using high level programming languages. If your "teacher" somehow thinks this is a good idea you need a better teacher. [url]http://en.wikipedia.org/wiki/Xor_swap[/url] Way too …

Member Avatar for Salem
0
222
Member Avatar for Daan

/usr/bin/gdb This is the command line debugger. /usr/bin/ddd This is the 'visual' wrapper around gdb. You can use this to point at lines of code, insert breakpoints, examine variables etc.

Member Avatar for joe_blow
0
87
Member Avatar for joshilay

> cout<<(j++)&&(i++); What does this output - with extra ( ) cout<< ((j++)&&(i++)) ; If it's 0, look up the operator precedence table in your handy book.

Member Avatar for ~s.o.s~
0
93
Member Avatar for nwiner

> Why the reverse output? Make sure you understand the consequences of the link posted by WaltP Even though you might be able to come up with an explanation of why the output is reversed, there is no telling what would happen in any similar circumstance. Undefined behaviour is very …

Member Avatar for nwiner
0
108
Member Avatar for priya123

Well you could help yourself by telling us which actual error messages you see. > am compiling it in turboc Ah, good old stone age technology - have you sharpened the stone chisel recently? I'm also guessing you don't know the answer to the question "are you compiling C or …

Member Avatar for himanjim
0
186
Member Avatar for ultra vires

So just add the centre (cx,cy) to your calculations [code] r * cos(theta) + cx; r * sin(theta) + cy; [/code]

Member Avatar for jim mcnamara
0
329
Member Avatar for anyone

> send me a program to remove unnecesary space from a string in turbo c++ Who gets to decide what is "unnecesary" ? Read this [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] Then make an effort.

Member Avatar for Salem
0
110
Member Avatar for kookai

> xss.exe - 4 error(s), 0 warning(s) > void main As well as being wrong (see previous posts, it should be int), you're specifically saying that NO value should be returned. Yet later on (4 times to be precise), you have a return 1; etc. This isn't void, so the …

Member Avatar for Salem
0
907

The End.