1,359 Posted Topics

Member Avatar for AmrMohammed

**1-Q1.** It would be easiest to give an example, rather than explain it. Let's say you have the files foo.h int foo(int x); int bar(char* str); foo.cpp #include "foo.h" #define QUUX 23 int foo(int x) { return x * QUUX; } Then when the pre-processor has gone over it, the …

Member Avatar for mike_2000_17
0
260
Member Avatar for fonzi

There are several [unit testing frameworks](https://www.google.com/search?q=unit+test+framework) for each of those languages; an extensive (but not complete) list of them can be found [here](http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks). Of the ones for Java, far and away the best known is [JUnit](http://junit.org/). It is derived from the original Smalltalk SUnit testing library, and strongly influenced several …

Member Avatar for Schol-R-LEA
0
314
Member Avatar for daesung

OK, aside for the fact that the function header should be `int main()` and not just `main()`, what is the problem you are having?

Member Avatar for amrita111
0
83
Member Avatar for napninjanx

Actually, no. There are definite limits to computability. Look up [Alan Turing](https://www.google.com/search?q=alan+turing) and [the Halting Problem](https://www.google.com/search?q=halting+problem) for one well-known example of an undecidable proposition.

Member Avatar for Schol-R-LEA
0
76
Member Avatar for Ravish.Ahmad.Khan

As a matter of kindness to you (and anyone else reading this), I'll post the existing code properly indented; however, no one here is going to fix the problem for you. We will give advice, but not free homework answers. In any case, the answer was already given to you …

Member Avatar for Schol-R-LEA
0
229
Member Avatar for Ray124

OK, let me see if I have this correct: what you want is for to provide a timer which will wait either for *n* milliseconds, or until a key is pressed, correct? It sounds to me as if what you really need is to use a separate thread for the …

Member Avatar for TnTinMN
0
128
Member Avatar for favoredanteater

In the future, please use the 'code' menu button at the top of the editing window to paste in code samples. By default, the forum software does not retain indentation, which makes reading Python code especially difficult. As it happens, the causes of the problem are plain to see. First …

Member Avatar for Schol-R-LEA
0
210
Member Avatar for sk8ergirl

While I share stultuske's misgivings about external links, I went ahead and looked anyway - foolish, perhaps. Anyway, I noticed something that would not be evident if you had simply posted the code here, so you are fortunate that I did. What I noticed is the compiler output that follows …

Member Avatar for Schol-R-LEA
0
95
Member Avatar for Inshu

OK, I can see your getting flustered, so let's back away from the code for a bit and consider the overall problem you are trying to solve. Just what is the program supposed to compute, and how would you do it by hand if you had to? I don't mean …

Member Avatar for Lardmeister
0
753
Member Avatar for Delnith

While it is certainl;y more an intermediate to advanced level project, you might consider going through the [Scheme from Scratch](http://michaux.ca/articles/scheme-from-scratch-introduction) process. It not only is a nicely incremental project, meaning that at no one point should you get overwhelmed by it, but it also exposes you to a radically different …

Member Avatar for Schol-R-LEA
0
234
Member Avatar for Tuna_1

Aside from the fact that you are asking us to do your assignment for you (as it is a rather simple one, really), you haven't given enough information to solve it, as it depends on the contents of the memory at address 2000:0004 (technically, it also depends on the specific …

Member Avatar for deceptikon
0
246
Member Avatar for calvintmoss

**@Deceptikon:** While your suggestions are well thought out, they really don't apply to the MIPS architecture, which works significantly differently from the x86 architecture, especially with regards to using the stack. Among other things, the standard word size is either 32 or 64 bits, depending on the model of the …

Member Avatar for deceptikon
0
3K
Member Avatar for zygimantelis

It is pretty clear that you got this code from the [TKInter tutorial](http://www.pythonware.com/library/tkinter/introduction/hello-again.htm) and made the simple modification of trying to substitute a `Button` with an `Entry` box. Fair enough; that sort of thing is part of learning any new API. In this case, it didn't work out. It happens. …

Member Avatar for Schol-R-LEA
0
1K
Member Avatar for barrelr0ll

Well, it's not so much that (especially since 60 lines isn't all that much) as it is the tendency of newcomers to simply post their code without actually asking a question about it. In this case, we'd also need to see where you are setting `c_num`, as well.

Member Avatar for barrelr0ll
0
95
Member Avatar for Learningvinit

Does `gfunc_Realloc()` work correctly elsewhere? Have you tried writing a simple test program to check if the `gfunc_Realloc()` function behaves correctly in general (that is to say, when given some test data, it works correctly)? For that matter, are the `gfunc_Realloc()` and `gfunc_memAlloc()` in a separate compiled source file, or …

Member Avatar for Learningvinit
0
873
Member Avatar for syeda amna

I believe that what you are looking for is the `import` statement. If you have a Python file, say *test.py*, and wish to run the program in that source file while in the interpreter prompt, you can enter import test and, provided that the file *test.py* is in the same …

Member Avatar for syeda amna
1
585
Member Avatar for robert.montgomery.75054

The problem is that you aren't resetting either `count` or `totalGrade` before beginning the second loop. also, in both loops, you can (and probably should) move the calculation of `average` out of the loop body. I think you'll also have a problem with the second loop's end condition, as you …

Member Avatar for robert.montgomery.75054
0
226
Member Avatar for MrEARTHSHAcKER

The issue here is that `this` is a pointer to the object as a whole, not just to an array; you would need to access the `string`'s internal array to do this, and since that array is `private`, you cannot do that - at least not directly. What you want …

Member Avatar for deceptikon
0
119
Member Avatar for on93

As a matter of fact, I do. However, it would not be very helpful for me to simply give the code to you; learning is the goal here, after all. I will say that you are overthinking things a bit (been there, done that, bought the tee shirt). Rather than …

Member Avatar for Schol-R-LEA
0
125
Member Avatar for on93

What is the expected result? I suspect that you have misunderstood the last part of the summation formula. I suspect it is supposed to go more like: n ---- \ n 1 + / (-1) n! / (x - n) ---- i = 2 or, 1+2!/((x-2))-3!/((x-3))+4!/((x-4)) - ... n!/((x-n)) which …

Member Avatar for on93
0
138
Member Avatar for mwsh

You would use the `bit?` predicate to test the value first, then if it is a single bit, emit the value unchanged; otherwise, perform the split.

Member Avatar for Schol-R-LEA
0
149
Member Avatar for Neversleepin

You would have to discuss the matter with the original coder to get a definitive answer, actually. It really has nothing to do with the `BufferedReader` c'tor itself, which just takes a filename as it's argument. As for line 3, that's the beginning of an exception frame. You would need …

Member Avatar for JamesCherrill
0
182
Member Avatar for Malymieczek

The first step in solving this problem, I think, is learninig to indent your code in a consistent and legible manner; since this is Java, I recommend following the official [Java Style Guide](http://www.oracle.com/technetwork/java/codeconv-138413.html), at least as far as the basics are concerned. import java.util.Scanner; import java.io.*; public class prog166d2 { …

Member Avatar for Malymieczek
0
131
Member Avatar for lpanc
Member Avatar for Schol-R-LEA
0
150
Member Avatar for BunBean

*As per request, one boilerplate answer coming up:* First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet? No one here will simply hand you a …

Member Avatar for Schol-R-LEA
0
418
Member Avatar for GeneClaude

Before addressing your question, I would like to point out some issues with the code as given, ones which may help understand the problem at hand. Before I do, would you mind telling us what compiler and IDE you are using? It may help us understand certain aspects of this …

Member Avatar for Ancient Dragon
0
119
Member Avatar for FallenHero

The short answer is, you can't. NASM is specific to the x86 and x86-64 family of processors; you will need a Z80 assembler (that's the processor the TI-84 uses) which produces object code which can be loaded to the calculator in order to program for it. The TASM you mentioned …

Member Avatar for Schol-R-LEA
0
223
Member Avatar for hg_fs2002

Macros, like all preprocessor directives, are expanded before the compiler is run; thus, no, you cannot override a macro definition with a C language statement. A bit more explanation may be in order here. When you go to compile a program in C (or C++), you are actually invoking at …

Member Avatar for deceptikon
0
220
Member Avatar for bobejoe
Re: push

[This posting](http://www.daniweb.com/software-development/assembly/threads/424508/disassembling#post1814196) may help explain the purposes behind the stack instructions a little better.

Member Avatar for Schol-R-LEA
0
99
Member Avatar for emorales

The problem is actually two-fold: first, you are loading a value where you need an address; and second, you are trying to write out an integer with a function which expects a character buffer. The solution to the first problem is to change the code so that it puts the …

Member Avatar for Schol-R-LEA
0
7K
Member Avatar for Seswing142

Before we go anywhere with this, I want you to be clear about two things. First, that this is actually two different programs which you'll need to write, and second, that **you** will need to be the one to write them. We can give advice and help, but we cannot …

Member Avatar for Seswing142
0
352
Member Avatar for constantinos21
Member Avatar for np complete
0
74
Member Avatar for DrunkenCoffin

The problem isn't in the comparison, nor in the `je` or `jne` instructions; it is in the declarations for `a` and `b`. For each of those, you define them as a 2 reserved bytes; howvever, the `mov eax, [a]` instruction assumes that `a` is a doubleword (4 bytes), and as …

Member Avatar for DrunkenCoffin
0
446
Member Avatar for SHASHWATH

As a piece of advice, I can suggest this: assuming that the language you are indenting is C (or one with a similar block syntax, such as Java or C++), then the simplest solution is: set the indent amount to four set the indentation level to zero for the length …

Member Avatar for WaltP
-3
146
Member Avatar for Kristjon

In the declaration of `struct author`, you define `down` as type `link`, which is a `typedef` for `struct author*`. What you actually want is for it to be a `ptr` (that is, `struct book*`). Thus, you'll want to move the `typedef` of type `ptr` up to before the definition of …

Member Avatar for Kristjon
0
331
Member Avatar for alaa sam

First off, you should always use `int` as the type for `main()`, not `void`. While some compilers allow for other return types, the only really correct (in the sense of portable and matching the standard) declaration is `int main()` (or, when using command-line arguments, `int main(int argc, char* argv[])`). Second, …

Member Avatar for alaa sam
0
213
Member Avatar for chotep

Rather than sharing the code this way, which has some serious disadvantages (no versioning, having to manually cut and paste the code into place, risking overwriting the good code with the older code, etc.), I would suggest finding a source repository such as [SourceForge](http://www.sourceforge.net/) or [GitHub](http://www.github.com) and share your code …

Member Avatar for chotep
0
171
Member Avatar for Alochai

The ampersand actually marks the character which is to be used as the hotkey; if you look at the menu as it actually is rendered, you'll see that those letters all are underscored. In the case of 'Exit', the 'x' is the hotkey character (that is to say, if you …

Member Avatar for Alochai
0
138
Member Avatar for Skrell

What it comes down to is that each state transition can have it's own behavior, represented by a function. In this case, all of the states use the same function to handle the different states, but that is just to keep the code simpler; in practice, you would probably have …

Member Avatar for Skrell
0
294
Member Avatar for letterG

As an aside, you will want to use `int` as the return type of `main()` in the future. Strictly speaking, `void main()` isn't legal C++, even if some compilers accept it. Just a piece of advice, which you may need to know about as most newer compilers will flag `void …

Member Avatar for letterG
0
162
Member Avatar for rithish

**Rithish**: The issue is not in the *behavior* of the two forms of the function, but rather is in the wording of the C language standard, and less directly, in the behavior of the majority operating system shells. You see, it isn't incidental that `main()` was type `int` even in …

Member Avatar for Schol-R-LEA
0
122
Member Avatar for cwarn23

**@Thekilon:** You should check the dates of a thead before posting to it. The original conversation ceased over nine months ago. For the record, in the unlikely case that the original poster is still interested in this thread, I believe that by 'punch cards' the OP is referring to [machine …

Member Avatar for finalist
0
1K
Member Avatar for np complete

Assuming you are running Windows, the answer is, you don't. DOS TSRs required low-level access to the BIOS, and hooking an interrupt; they are notoriously badly behaved under Windows, even inside of the cosnole or a DOS box. Under Windows, then the equivalent of a TSR is simply a program …

Member Avatar for deceptikon
0
731
Member Avatar for 111100/11000

**EDIT:** I originally thought that this was a different problem, but then I noticed that you were, in fact, reading in a number and not a character. My error. Looking over the code again, it's simply that you aren't putting `break;` statements at the end of each case of the …

Member Avatar for Schol-R-LEA
0
119
Member Avatar for milindchawre

That depends. Just how do you intend to use them? We really would need more detail to give you useful advice. If you simply need a reference, the [this](http://http://www.cplusplus.com/reference/clibrary/cstdio/) should do nicely; while that site is for C++ rather than C, the C I/O libraries work the same in both …

Member Avatar for Ancient Dragon
0
302
Member Avatar for I_m_rude

To answer to OP's question, the exact use of bit fields is to allow you to pack several small values into a single integer value, by defining the values in terms of how many bits they need in order to be stored efficiently. As Deceptikon said, they are primarily useful …

Member Avatar for deceptikon
0
141
Member Avatar for fbudek

> what code would I have to use in the bootloader to open the second file? That depends on what kind of filesystem you are using, and what executable format the file is in. For example, my own original boot loader simply assumed that the second stage was in sector …

Member Avatar for prashant14214
0
704
Member Avatar for laavanya

The first thing we need to know is what operating system you are running under. For now, I'll assume some version of Windows, probably XP but that's just a guess (***edit:*** your profile says Windows 7. Knowing that makes the rest of this easier.) The next thing we need to …

Member Avatar for rithish
0
144
Member Avatar for 3e0jUn

Assuming you are using Python 3.x, then the input isn't going to be a tuple of separate strings, but one whole string. This means that you'll need to use `.split()` on the returned string in order to get the separate tokens. def shell(): in_string = input ('> ') tokens = …

Member Avatar for TrustyTony
0
187
Member Avatar for rdrahul809

OK, we can see that you have these two programs written, but what have you done about the *current* assignment? BTW, three things to take note of. First, you should always declare `main()` as type `int`; while `void main()` is accepted by some older, non-standard compilers, it is not actually …

Member Avatar for Schol-R-LEA
0
106

The End.