5,237 Posted Topics
Re: Try adding \n to your debug printf statements, or follow the printf with [ICODE]fflush(stdout);[/ICODE] | |
Re: > but structs and unions are instantiated in a fixed order? Is this true? Where can I find this information? Yes (for C anyway), members of a struct are arranged through memory in the order in which you declare them. What you have little control over however is what the … | |
Re: How about [code] if(m_velocity.x == 0) { result = 0; } else { result = ToDegrees(atan(m_velocity.y/m_velocity.x)); } return result; [/code] Seconds spent over-optimising what any half-decent compiler will manage to do just fine can save days of debugging time later on. Sure, the code looks just like that now, but … | |
Re: I thought it was __LINE__ __FILE__ [url]http://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros[/url] | |
Re: So what do you want us to do about it? Do you have a C compiler which targets your processor? The GCC compiler does - [url]http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Submodel-Options.html#Submodel-Options[/url] Having found that, does your existing algorithm have adequate performance without resorting to hand-crafting fixed point for everything? As a first step, I would … | |
Re: [code] void Sailboat::Calcfee(double _z) { double LOA = length; if (commercial = false) { _z = LOA*50; } if (commercial = true) { _z = LOA*50+7.5; } } [/code] This function doesn't do anything, and it still does it wrong. Use == for comparison, not = In fact for boolean, … | |
Re: Your i+1 means you're reading off the end of the array. Also, finding the maximum is a lot simpler than this. | |
Re: You don't specify the types when you call the function. [ICODE]hesap.arith_ex(x,y , z);[/ICODE] But you also have no x,y,z to pass to the function either. | |
Re: Iteration is when the same question keeps getting [URL="http://cboard.cprogramming.com/showthread.php?t=82839&highlight=iteration"]asked[/URL] Recursion is when the same question gets [URL="http://www.daniweb.com/forums/thread124395.html"]answered[/URL] ;) | |
Re: Keep a diary of which programs you actually use in any session. Then delete all the crap from your startup which you don't consistently use in every session. | |
Re: [code] std::map <std::string, std::string> array; array["fruit"] = "apple"; [/code] | |
Re: Well if you declare the pointer the right way, then yes you can allocate the whole 2D array in one step. [ICODE]float (*vertices)[3];[/ICODE] But this only works when all the minor dimensions are constants. BTW - Use [ICODE]std::vector[/ICODE] in C++. | |
Re: > i want to take information (i.e. strings) from an existing program How do you know it stores strings? Just because you see strings on screen doesn't mean it stores those same strings internally for any length of time. Routing the program's net connection through your own little proxy would … | |
Re: > what about solving little/big endian problem by doing appropriate typecast before writing to file? Because endian can't be fixed with a simple cast. You have to write code to rearrange the bytes into the correct order. > Is there any standard function to test the endianess of the system? … | |
Re: Do you also have a makefile in the parent directory, which runs the two sub-directory makefiles, then combines both results into a single program? In each sub-dir makefile, you could set the compiler options to also have [ICODE]-I../DIR_B[/ICODE] as an additional search path. | |
Re: So post your best attempt. Who knows, you may be closer than you think. | |
Re: Shame about the lack of indentation :icon_rolleyes: | |
Re: Well checking the integrity of say a JPG file would be different from say a WMV file. | |
| |
Re: [url]http://www.daniweb.com/forums/thread122847.html[/url] | |
Re: The forum is littered with examples, it shouldn't take too long to find something. | |
Re: Porting from what? C? x86 ASM? Something else? | |
Re: Why are you still using void main? [url]http://www.research.att.com/~bs/bs_faq2.html#void-main[/url] [url]http://c-faq.com/ansi/maindecl.html[/url] It's wrong pure and simple, and just because your compiler accepts it doesn't make it any more right. Plus, you need to work on your indentation as well. If it looks better in your IDE (everything lined up nicely) than in … | |
Re: First I would suggest you create a 'printList' function which prints out the entire list in detail, so you can easily confirm it's structure at any point in the program. Second, start by testing known expressions. Third, the block of code which deletes two nodes in result of evaluating 'a' … | |
Re: Is there anything wrong with the output of [ICODE]g++ -S prog.cpp[/ICODE] Use it as a guide for your own attempt. | |
Re: > With Q4 the answer is D 12.0 but if u work it out you get 12.5 ?? Think about the difference between integer division, and float division. Which applies in this case? > else cout>>"there" Consider which of the 'if' statements this else statement binds to? | |
![]() | Re: It's because your crusty old Turbo C (which is like a decade out of date) doesn't understand the long filenames of your nice new OS (which is it, XP or Vista?). Get a compiler which is good for this millenium, and compatible with the win32 API. A popular choice would … ![]() |
Re: Reposted here - [url]http://www.daniweb.com/forums/thread123537.html[/url] | |
Re: Which Operating System / Compiler / Graphics library are you using? Have you (for example), got as far as say drawing a line and changing it's colour? | |
Re: awk '$1==9009709' file.txt | |
Re: Well 'graphics' is a bit vague, what sort of graphics? Perhaps a thermometer, running from 'green' to 'red' depending on how much energy has been used. Or perhaps a series of measurements plotted as a line graph. Now, what do YOU mean by graphics? | |
Re: [url]http://clusty.com/search?query=mp4+file+format&sourceid=Mozilla-search[/url] Maybe refine the search with terms like "source code" or "library"? | |
Re: Use cin.getline() to read all your input, then you don't get caught up with all the left-over characters normal cin >> var leaves behind. | |
Re: [url]http://www.daniweb.com/forums/announcement125-2.html[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#homework[/url] | |
Re: > I can see from the screen dump that d0 contains A And that is the same as 10 decimal. Perhaps read the documentation to find out what other services those trap #14's offer. If there is nothing, then you'll have to convert the number to a printable string yourself. | |
Re: It means they're allocated by the compiler when you compile the program, not when you run the program. | |
Re: You can't assign a whole array, you need to copy it one entry at a time. | |
Re: > Terminates with: 'No source available for "fclose@@GLIBC_2.1() " ' You get these in debug builds because the code for fclose uses assert() to validate the input parameters. If you were in a debugger at the time, you'd know exactly where to start looking. In this case, fclose() is likely … | |
Re: It's the non-reply to their other [URL="http://www.daniweb.com/forums/thread123528.html"]thread[/URL] | |
Re: Using more { } to denote exactly which bits of code belong to which block would certainly help clarify the problem. | |
Re: First [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] Then perhaps [url]http://www.catb.org/~esr/faqs/smart-questions.html#beprecise[/url] Then restate your question in English (not kiddie script), and state the Operating system and compiler you want this to run on. And try to be more specific than say "windows" and "borland" for example. | |
Re: > infile >> numbers[capacity]; This doesn't fill the array for you, you have to do that yourself with a loop. All this does it trash beyond the end of the array. | |
Re: So are you using a cross-platform GUI toolkit such as wxwidgets? How much GUI programming have you actually done up to now? | |
| |
Re: Start with a loop which searches forward 'pos' nodes or until the end of the list. Can you do that much? | |
Re: Why not try using it for yourself and find out? Depends what sort of beginner you mean. - experienced programmer who wants to "begin" to program in assember - probably fine - utter noob who only figured out how to turn on the machine a few days ago and wants … | |
Re: Pipes are part of the POSIX operating system, and nothing to do with the language. As for classes, maybe - I dunno. I've reached my google quota for the day. | |
Re: [url]http://clusty.com/search?query=test+driven+development&sourceid=Mozilla-search[/url] | |
Re: Strings are a pointer type (char * or more recently const char *), so yes you can use the subscript operator on them. | |
Re: > fp = fopen(“data.dat”, “ab”); What sort of quotes are these? > show(); show() expects a lot of parameters. Next time, post error messages. Also, when you've got something which does something useful, make a copy of it. |
The End.