3,183 Posted Topics
Re: > When I hear function I think about maths, with f(x)= 2x + 4. Computer science and programming are rooted in mathematics, so that's not a bad way to approach the concepts. Taking your example, it translates easily to C++ like so: int f(int x) { return 2 * x … | |
Re: > like why they named it as main only and not other??? That's an easy one. C inherited the name of the starting point from B. > and why we have to write main() compulsory in prgoram A program must have a starting point. In assembly this constitutes an address … | |
Re: Your loop is incorrectly placed. It should wrap all of the prompts, input request, computation, and output for each temperature: Set Temperature = 0 While Temperature != -999 Write “enter a temperature number or press -999 to quit” Input Temperature Set F = 9 * Temperature / 5 + 32 … | |
Re: Inline assembly is *very* compiler dependent. Are you using the same compiler to build this program as your teacher used to write it? | |
Re: > but some fool is looking for help to run the code shown Thanks for notifying us of a thread that fell through the cracks. | |
Re: Um...your thread title and post message are completely unrelated. Can you be specific as to what you want to accomplish? | |
Re: > When I try to store the location of fp (file pointer) at a desirable location How exactly are you doing this? While FILE is supposed to be an opaque type, it's generally implemented as a structure. If you're storing the pointer to a FILE then that's meaningless. If you're … | |
Re: Rather than try to decipher and work with that mess, I'll give you an example of what I think you're asking for: #include <iostream> #include <string> #include <Windows.h> #include "coniolib.h" namespace { win32::ConioLib conio; enum { KEY_ENTER = 13, KEY_ESC = 27, KEY_UP = 256 + 72, KEY_DOWN = 256 … | |
Re: For starters, if you're *ever* going to expect to compare `ch` against `EOF`, then you must declare `ch` as `int`. You'll notice that all of the character I/O functions work with *int*, and the reason for that is `EOF`. | |
Re: > Avoid using system calls in your program. Too vague, and Walt's rationale (from the link) is largely moot: 1. *"It's not portable."* The system() function is inherently non-portable because its argument is dependent on available system console commands. Though it's wise to acknowledge this when choosing to use it, … | |
Re: I replied to your other thread. Did you take my advice? | |
Re: http://php.net/manual/en/function.date.php | |
Re: I considered forcing you to post the actual error message rather than the error code because most people haven't memorized all of the codes for Visual C++. But if you prototype your min() function, you'll fix those two and be left with the rogue semicolon in one of your output … | |
Re: > I was reading somewhere in a forum that using switch case to do file handling was unstable. That's nonsensical. Nothing about a switch or "file handling" in general discourages stability. It's certainly possible to write brittle code, but that's a problem with the programmer, not the constructs being used. … | |
Re: > Do i just have to put a * instead of + and prodcut instead of sum? If so it didn't run. Nope, you also need to define and initialize v1 and v2. Then it'll work: #include <iostream> int main() { int v1 = 2; int v2 = 5; std::cout … | |
As the title says, it's a simple trie class written in C++11. The only operations implemented are insert, remove, and search (both prefix and exact matches). I sort of abandoned the test/debug process, and while I'm somewhat confident that there aren't any serious bugs, I can't guarantee it. Use this … | |
Re: > arrays are the same thing as pointers(arrays are a series of pointers) Wrong on both counts. Arrays are not pointers, period. There are two situations where C can trick you though: 1. In value context (which happens to be most of the time), an array name will be converted … | |
Re: Just to make things crystal clear, `NULL` is a macro intended for use as a null pointer, it should never be used as the null character (`'\0'`, also known as NUL with one L). While in C++ `NULL` is defined as `0` and that's compatible with the null character, it … | |
Re: > Enter a sentence: you can cage a swallow can't you? > Reversal of sentence: you can't cage a swallow can you? I'm assuming you meant the reversal to be **"you can't swallow a cage can you?"**, because the one you posted would require a bit more work in specifying … | |
Re: > scanf("%"PRIu16, &y); The PRI\* macros are for printf. Use the SCN\* macros for scanf, they're not interchangeable: scanf("%"SCNu16, &y); | |
Re: The exercise seems to be one for paper and pencil. The first variable (`a`) has a hypothetical address of 0xFF2a. You're to determine the addresses of the other variables, and also work out the values of the pointers and variables after all of the listed statements are "executed". For example, … | |
Re: The problem is on line 47, where you overwrite `temp` but `temp` was already NULL, so the tree doesn't reflect the change. I'm also concerned that you may be somewhat confused as to how a trie works. Consider the following example: #include <limits> #include <memory> #include <string> #include <vector> template … | |
Re: I don't know about you, but the error *I* got was complaining that your node structure is incorrect. The next node should be a pointer to node, not a pointer to int: struct node{ int id; node *next; }; I didn't look any further since that right there was a … | |
Re: You don't embed DLLs into executables, you package them in an installer such that they're copied to and registered with the target machine. So in your case you need to create a setup and deployment project. This project will produce an MSI that will handle installing all of the required … | |
Re: Change your code so that you don't fight the design of Qt. QObjects are non-copyable by design, and that was an explicit choice, so making it happen will be inherently awkward and brittle. How about instead of keeping a copy, which I assume is because you want to have a … | |
Re: Consider [this](http://code.google.com/p/c-standard-library/source/browse/includes/std/string.h#6) implementation of the standard library. size_t is defined as: /* size_t is defined in multiple headers */ #ifndef _HAS_SIZET #define _HAS_SIZET typedef unsigned size_t; #endif That's all it is! **Don't read too much into it, size_t is nothing more than a typedef for one of the supported unsigned … | |
Re: > How i can combine them together ? That depends on your compiler, really. If you're using an IDE you can just lump everything together in the same project and then build it. The IDE will take care of the grunt work. If you're using a command line compiler, they … | |
Re: > How about this one? Not bad for a basic attempt at iterative and recursive algorithms. Given that the complexity of the recursive fibonacci algorithm is horrendous, I'd also include a memoized version: int Fibonacci_Recursion(int n) { if (n < 1) { return 0; } else if (n < 3) … | |
Re: In the context of a program's instructions it's a non-issue. You access the logical addresses and the operating system will handle the conversion to physical addresses. | |
Re: If you're writing code that depends on an exact data type size (and often on a data type size in general), you're probably doing something wrong. | |
Re: > but i m not able to think of any such thing.. That's sad. So you don't have any interests? You don't understand your audience well enough to figure out what might interest *them*? You don't have any teachers or peers who have any interests or ideas for *anything at … | |
Re: Just use the addition operator: select column1 + column2 from mytable; | |
Re: Are you getting this problem in the quick reply box or on edit? What version of Firefox? What OS and version of the OS? Do you have any notable add-ons installed? If you view page source are the input tags present and just not rendered, or are they missing entirely? … | |
Re: Why does the coordinator need a completely separate table and functions? Typically administrative users are still users, the only difference is permissions attached to the account. | |
Re: Probably not, unless the publisher has released the book for free. Otherwise it's under copyright and free downloads are illegal. | |
| |
Re: First and foremost, I think insFirstNode() is poorly named. It implies that the node will be prepended to the list in all cases, but in reality what it does is *append*. As far as converting the list to an array, it's simplicity itself. But a few things will need to … | |
Re: I'm not sure I understand what you're describing, can you be more specific? | |
Re: So am I to assume that you completely ignored the replies from your [other thread](http://www.daniweb.com/software-development/c/threads/447556/different-result-by-memcmp-when-used-on-hp-and-when-used-on-linux) that asks essentially the same question? | |
Re: Could you be more specific about the OSes in question? I suspect that it's an endianness issue. I'm not aware of HP-UX support on little endian architectures, but Linux supports both big and little endian depending on the hardware. If you're running Linux on something like an x86 then I'm … | |
Re: > I honestly feel this person's post has been misunderstood. Helping someone who has openly admitted to piracy validates and enables piracy. Allowing threads on pirated software could potentially put Daniweb in a sticky legal position, so the appropriate response is to strongly suggest acquiring a legitimate copy of the … | |
Re: Sorry, but it doesn't work like that. All of the links in your tree are pointers to the memory of your current process. If you save those pointer values, they'll be meaningless when read by another proces. Really the best you can do is save the tree's *data* in a … | |
Re: > Is there any reason as to why the option to specify the quoted user isn't included anymore nowadays? Our current Markdown parser doesn't support this as far as I'm aware. In general Dani has been against me modifying those parts (ie. the Markdown parser and the editor parser) of … | |
Re: `4 * sizeof(double*)` bytes. You can't assume the size of a pointer, so the 32-bit machine part is irrelevant to the question. | |
Re: Specify a section. The three most common are: * 1: General Commands * 2: System Calls * 3: Library Functions So if you want the open() function, you'd search using `man 3 open` | |
Re: > i want to knoe the working or some knowledge about its implementation. The whole point of abstracting things into an interface is that you don't *need* to know about the implementation. But it's a fairly safe bet that you're looking at some variation of a hash table. Open up … | |
Re: > Because it's required in the Assignment. Then I suspect you've misinterpreted the assignment. Could you post it? | |
Re: > My question to you all is, are there elements from each of the commercial and open source operating system that you would combine to make the best operating system. While looking at prior art is a good way to get started, I wouldn't buy an OS that's nothing more … | |
Re: Have you tried that code? I mean, a simple test program would have answered your question in far less time than it took for me to notice it and answer. But yes, you can use bitwise NOT in a preprocessor directive. |
The End.