3,183 Posted Topics

Member Avatar for Kareem Klas

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

Member Avatar for PrimePackster
0
1K
Member Avatar for mallikaalokam

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

Member Avatar for deceptikon
0
145
Member Avatar for christinocasio

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 …

Member Avatar for christinocasio
0
4K
Member Avatar for jay889000

Inline assembly is *very* compiler dependent. Are you using the same compiler to build this program as your teacher used to write it?

Member Avatar for jay889000
0
482
Member Avatar for TnTinMN

> but some fool is looking for help to run the code shown Thanks for notifying us of a thread that fell through the cracks.

Member Avatar for deceptikon
0
103
Member Avatar for BARI DANIYAL

Um...your thread title and post message are completely unrelated. Can you be specific as to what you want to accomplish?

Member Avatar for rubberman
0
143
Member Avatar for anumash

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

Member Avatar for anumash
0
188
Member Avatar for Shft

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 …

Member Avatar for deceptikon
0
340
Member Avatar for anumash

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

Member Avatar for deceptikon
0
408
Member Avatar for on93

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

Member Avatar for deceptikon
0
152
Member Avatar for antor
Member Avatar for deceptikon
0
111
Member Avatar for GraficRegret
Member Avatar for on93

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 …

Member Avatar for Banfa
-1
570
Member Avatar for Tonyi1

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

Member Avatar for Tonyi1
0
354
Member Avatar for Kareem Klas

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

Member Avatar for deceptikon
0
153
Member Avatar for deceptikon

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 …

Member Avatar for deceptikon
3
405
Member Avatar for totalwar235

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

Member Avatar for deceptikon
0
179
Member Avatar for nitin1

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 …

Member Avatar for Moschops
0
162
Member Avatar for ashish2expert

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

Member Avatar for ashish2expert
0
924
Member Avatar for dewdropz

> scanf("%"PRIu16, &y); The PRI\* macros are for printf. Use the SCN\* macros for scanf, they're not interchangeable: scanf("%"SCNu16, &y);

Member Avatar for deceptikon
0
240
Member Avatar for ConfusedLearner

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

Member Avatar for raptr_dflo
0
219
Member Avatar for nitin1

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 …

Member Avatar for deceptikon
0
129
Member Avatar for MRehanQadri

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 …

Member Avatar for deceptikon
0
193
Member Avatar for riahc3

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 …

Member Avatar for TnTinMN
0
373
Member Avatar for capton

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 …

Member Avatar for deceptikon
0
276
Member Avatar for anumash

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 …

Member Avatar for deceptikon
0
185
Member Avatar for anestistsoukalis

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

Member Avatar for deceptikon
0
211
Member Avatar for andrisetia

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

Member Avatar for deceptikon
0
262
Member Avatar for tony75

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.

Member Avatar for tony75
0
107
Member Avatar for LevyDee

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.

Member Avatar for LevyDee
0
179
Member Avatar for kewlankit

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

Member Avatar for Miorfs
0
219
Member Avatar for hkkkk

Just use the addition operator: select column1 + column2 from mytable;

Member Avatar for deceptikon
0
96
Member Avatar for Reverend Jim

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

Member Avatar for riahc3
0
499
Member Avatar for <M/>
Member Avatar for ebanbury

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.

Member Avatar for ebanbury
0
133
Member Avatar for sunn shine

Probably not, unless the publisher has released the book for free. Otherwise it's under copyright and free downloads are illegal.

Member Avatar for ddanbe
0
116
Member Avatar for pucivogel
Member Avatar for pucivogel
0
158
Member Avatar for on93

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 …

Member Avatar for on93
0
113
Member Avatar for <M/>

I'm not sure I understand what you're describing, can you be more specific?

Member Avatar for <M/>
0
96
Member Avatar for Learningvinit

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?

Member Avatar for Learningvinit
0
176
Member Avatar for Learningvinit

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 …

Member Avatar for Learningvinit
0
600
Member Avatar for BigPaw

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

Member Avatar for caperjack
1
319
Member Avatar for hitro456

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 …

Member Avatar for rubberman
0
612
Member Avatar for tux4life

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

Member Avatar for Dani
0
166
Member Avatar for wschamps42

`4 * sizeof(double*)` bytes. You can't assume the size of a pointer, so the 32-bit machine part is irrelevant to the question.

Member Avatar for rubberman
1
279
Member Avatar for fyra

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`

Member Avatar for rubberman
0
122
Member Avatar for nitin1

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

Member Avatar for mike_2000_17
0
423
Member Avatar for MRehanQadri

> Because it's required in the Assignment. Then I suspect you've misinterpreted the assignment. Could you post it?

Member Avatar for Ancient Dragon
0
194
Member Avatar for ajmckay

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

Member Avatar for rubberman
0
171
Member Avatar for hg_fs2002

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.

Member Avatar for deceptikon
0
240

The End.