1,359 Posted Topics

Member Avatar for ConfusedLearner

As an aside, I have two comments to make. First off, while [indent style](http://en.wikipedia.org/wiki/Indent_style) is largely a matter of personal preference, it is a good idea to adopt *some* form of indentation and use it consistently. It is important for readability, especially as programs grow longer; and while it may …

Member Avatar for Schol-R-LEA
0
165
Member Avatar for WDrago

One thing that doesn't seem to have been mentioned is that namespaces are less for projects by a single individual, than they are for integrating disparate libraries and projects by different groups of developers. While namespaces are a boon to a single programmer, they are a necessity to developers working …

Member Avatar for Ketsuekiame
0
205
Member Avatar for dusto

OK, in that case... actually, you're quite close to it, as it happens. You simply want to have another print line to print a hash before the inner loop, and change the print inside the loop to printing a space: NUM_STEPS = 6 def main(): for r in range(NUM_STEPS): print …

Member Avatar for TrustyTony
0
268
Member Avatar for sai.aleenus

I am certain someone can, if you you show us what you've already done on the problem. If you haven't started working on it yet yourself, then I would recommend familiarizing yourself with the [details of the algorithm](http://books.google.com/books?id=JypoXt5hHrkC&pg=PA92&lpg=PA92&dq=hooke+jeeves#v=onepage&q=hooke%20jeeves&f=false) before proceeding. We are here to help you learn. This is not …

Member Avatar for Schol-R-LEA
0
711
Member Avatar for PSB92

Using the `input()` function in Python 2.x is generally considered a bad idea, as it will actually evaluate the statement as if it were a line of Python code. This leaves a large security hole that anyone could exploit - if,instead of just a number, the user were to enter …

Member Avatar for Schol-R-LEA
0
162
Member Avatar for CutP

I have to agree with Terminator1337 on this, the code for the `main()` function in particular is wretched (not to mention incorrect - in C++, `main()` should always return an `int`, with no exceptions to the rule). The fact that it appears to have been given to you by the …

Member Avatar for deceptikon
0
280
Member Avatar for chocolatte.lavista

Could you give us more information about what you need, and what you already know how to do? The problem description is rather sparse, at best. Do you have anything in particular in mind as far as what the program should do? A few questions to get things going: * …

Member Avatar for Schol-R-LEA
0
127
Member Avatar for Violet_82

First off, you need to recall that Java is case-sensitive. which means that `PackageData` and `packageData` are two different things. The former is the class name, the latter is an instance of the class declared in the `main()` method of `PackageDataTest`. Second, the `toString()` method is something of an exceptional …

Member Avatar for Violet_82
0
159
Member Avatar for coding101

Unbuffered I/O is operating system dependent; all of the standard C library functions operate on buffered streams. What OS are you running under?

Member Avatar for coding101
0
83
Member Avatar for nick.rechtien.5

There are quite a few problems with this program as it is written, but all of them can be fixed with some patience. The biggest issue I see is that you are reading in the name of the animal to be found, then overwriting that name repeatedly in the condition …

Member Avatar for nick.rechtien.5
0
282
Member Avatar for octarock

Wait a moment, how old is the textbook you are using? While Fortran is still in use - though in a form completely different from it's predecessors - Algol 60 and Algol 68 are long dead. Also, neither Algol 60 nor most older FORTRAN compilers have pointers, or structures for …

Member Avatar for Schol-R-LEA
-2
171
Member Avatar for mkweska

Perhaps it would make more sense to start with a parent class, Profession, which would have the various attributes in common to all the subclasses: class Profession(object): def __init__(self, name, strength, pilot, intel, stamina): self.strength = strength self.pilot = pilot self.intel = intell slef.stamina = stamina # other methods common …

Member Avatar for Schol-R-LEA
0
219
Member Avatar for govindh2so4

Both answers are accurate, but Banfa's answer is the correct one. Nutster's answer is true in the majority of implementations, but not all, and according to the standard the behavior is implementation dependent. You cannot count on *any* specific result without knowing the implementation in question. As one [famous quip](http://www.catb.org/jargon/html/N/nasal-demons.html) …

Member Avatar for Schol-R-LEA
0
659
Member Avatar for somjit{}

Your senior consultant seems to be having a senior moment, I would say. This advice is not only wrong, it is dangerous, because VB6 and Oracle 9i are no longer supported by Microsoft and Oracle, respectively, and neither can even be run on an version of Windows more recent than …

Member Avatar for chowdhary.barnali
0
241
Member Avatar for bdheeraj

I should mention that the more conventional solution to this issue is to store a URL or some other sort of path to the image file, rather than the image itself. This avoids the whole issue entirely, as you then would simply access the image file normally. Would this be …

Member Avatar for bdheeraj
0
201
Member Avatar for Allorango

Do you know if the DLL a C++/CLI DLL? If so, then calling it directly like this may not be possible. You may be able to use COM Interop to connect to it, but even that isn't entirely certain, if the DLL is 64-bit code. BTW, why do you have …

Member Avatar for Allorango
0
150
Member Avatar for anirbanengg

I assume you are referring to and GCC-based IDE such as Code::Blocks or something similar here, correct? Basically, they are two different options for generating the executable, which some IDEs provide as a shortcut. They allow you to have two different sets of compiler options to be set up, one …

Member Avatar for anirbanengg
0
251
Member Avatar for game06
Re: oop

As pritaeas said, we need to know more about what you're planning on doing. However, as a general piece of advice, I would recommend defining an abstract parent class - let's call it `AbstractBullet` for now - and deriving the different sub-classes of `Bullet` from that. If you do that, …

Member Avatar for Schol-R-LEA
0
116
Member Avatar for ikeh theacla ij

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 solution on a silver platter. If you show …

Member Avatar for Schol-R-LEA
0
126
Member Avatar for nomorelogic

Most of these issues come from incorrect nesting. If you look at `main()`, you will see that you have an extra left brace, just after the `using namespace std;`, and that you fail to close the function. This means that you are in effect declaring `MenuSystem()` as two layers of …

Member Avatar for nomorelogic
0
527
Member Avatar for mical700

OK, and what was your question? **EDIT**: The rest of this was incorrect; I had overlooked the fact that `fgets()` stops at newlines. Please disregard.

Member Avatar for mical700
0
148
Member Avatar for phats more

For anyone unfamiliar with the game (as I am), the [Wikipedia article](http://en.wikipedia.org/wiki/Morabaraba) on it is at least a starting point. **phats more:** Can you be more specific about what you need help with? What have you tried so far? What do you know about C#, and what do you think …

Member Avatar for Schol-R-LEA
0
249
Member Avatar for nycfunnygirl

First off, I would leave the course, as they are teaching you HTML techniques that are thirteen years out of date. No one uses tag properties for presentation anymore, and officially, they've been removed from the language (though most browsers will still recognize most of them). Second off, no one …

Member Avatar for Schol-R-LEA
-3
203
Member Avatar for deltascrow

Anyone who says that the current generation of programmers is in some way inferior to those of the past, is clearly unfamiliar with the programmers of the past. You must recall that until very recently the vast majority - 90% or more - of programmers were COBOL coders, often with …

Member Avatar for mike_2000_17
2
192
Member Avatar for Mbokodvo

As Moschops said, Code::Blocks does in fact generate a stand-alone program whenever you compile a project. If you look in the project folder, you will find a folder marked Bin, with two sub-folders, called Debug and Release. By default, the compiled program goes into the Debug folder; this is a …

Member Avatar for ddanbe
0
285
Member Avatar for NikkiStars

As Moschops said, just what 'program analysis' means is going to up to the professor; there isn't really any standard meaning to it. In general, it means identifying the variables of the problem, describing the steps needed to solve the problem, and describing what user input or data is needed …

Member Avatar for NikkiStars
0
335
Member Avatar for saurabh.mehta.33234

What everyone is tap-dancing around is that, in order to get a consistent result, you need to synchronize the threads. This means that there would have to be an object which has a `synchronized()` block associated with it, which acts as a lock on that object - other threads cannot …

Member Avatar for stultuske
0
182
Member Avatar for Akshay nand
Re: c++

> please can you help me,I want to do my homework. Really? Because it sounds like you want *us* to do your homework for you. Sarcasm aside, there is a rule here at DaniWeb: *show your work.* If you want us to help you with a homework problem, you need …

Member Avatar for deltascrow
0
318
Member Avatar for giancan

My first suggestion is to look into the [csv module](http://docs.python.org/2/library/csv.html) in the standard library. It may save you from reinventing the wheel WRT comma-spearated value files.

Member Avatar for giancan
0
394
Member Avatar for CHOCHOCHO

Is there a specific requirement to use the bubblesort algorithm? With a linked list, an insertion sort would generally make more sense. The main thing you'll want for bubblesort that you don't already have is some kind of `swap()` function. Since it is a singly-linked list, you'll want to pass …

Member Avatar for Schol-R-LEA
1
1K
Member Avatar for tehsmartniss

While what mike_2000_17 said is all correct, the real reason is actually a lot simpler: C++ has no concept of console I/O because C++ - and many of the operating systems it operates under, including Unices - has no concept of a console. More importantly, C++'s standard libraries operates primarily …

Member Avatar for Schol-R-LEA
1
1K
Member Avatar for jchimz

Unfortunately, there is no standard way to read and display image files in C; it would depend on the operating system, the windowing manager, and the graphics library you are using. There exist several portable windowing libraries such as Qt, wxWindows, and GTK+, which include the ability to display image …

Member Avatar for Schol-R-LEA
0
109
Member Avatar for mdfaisalamin

What error are you getting? I assume that `dis` is either an instance variable or a class variable, and thus would be in scope for both methods, is this correct?

Member Avatar for ~s.o.s~
0
243
Member Avatar for hayate98
Re: Else

You would find it much easier to detect many bugs of this sort if you indent the code in a suitable fashion. While it may take some getting used to - it makes the code look like some sort of modernist poetry - it is well worth the trouble. There …

Member Avatar for hayate98
0
173
Member Avatar for nabeelkhanjadoon10

Can you please describe this 'too simple' project for us? We can only give advice when we know what we're dealing with...

Member Avatar for DoRight
0
7K
Member Avatar for shukla ronak

To give a perfectly serious and not at all snarky answer, the first question I have is: why Turbo C? Does the course you are taking require that particular compiler/IDE (I can't imagine any other reason for using such an antique, but I know that many schools in India and …

Member Avatar for Schol-R-LEA
-2
127
Member Avatar for jameosa

Let's start from, what do you know how to do already? Can you write something very simple, such as a program that prints a line of text (say, 'Hello, World!', to give one well-worn example)? Getting to the assignment at hand, do you know how to write a `for` loop? …

Member Avatar for pritaeas
0
265
Member Avatar for revelator
Member Avatar for Miorfs
0
4K
Member Avatar for Carc369

As an aside, if you are taking in case-insensitive user input as you are here, I would suggest using either `toupper()` or `tolower()` to set the case of the switch variable, thus avoiding the issue entirely.

Member Avatar for awaisahmad13
0
139
Member Avatar for vishalonne

The immediate cause of the errors are a) the statement `typeof(n)` in the initialization section of the for loop, and b) the lack of a semi-colon at the end of `f *= i`. However, this ignores a more serious conceptual error (for which the compiler gives only a warning), in …

Member Avatar for Tumlee
0
137
Member Avatar for hpre

Where is the error occurring? If you post the traceback - the *entire* traceback, please - it should show what line in the code the problem lies in. Also, what is the `search.Problem` class? I wouldn't need details, just a general overview of the parent class so I can better …

Member Avatar for Schol-R-LEA
0
268
Member Avatar for almondjoy

When you say Eclipse 'fell apart', what actually happened? As JamesCherrill says, Eclipse is generally quite stable, so any catastrophic problem with it is quite unusual and deserves some analysis.

Member Avatar for jalpesh_007
0
106
Member Avatar for slasel
Member Avatar for Hey90

What exactly is the behavior? Does it print the shoe data out correctly, or is that also failing? One problem I see is that when you add an element, it overwrites the first one, rather than adding it to the end of the array. You probably want this: //Add new …

Member Avatar for Hey90
0
251
Member Avatar for biscayne

Assuming you don't need the data after printing it out, I would recommend shortening the code thusly: if andexfield == elem: print andexfield for p in range(1, 17, 2): print p, print for q in range(2, 17, 2): print q, print The third argument of the `range()` function is an …

Member Avatar for Schol-R-LEA
0
827
Member Avatar for dean.ong.14

When you say that `import random` failed, just what do you mean? If you got an error message, post it with the full traceback. Otherwise, did it simply not do what you expected it to? I would recommend using the `random.shuffle()` function on the series of questions; however, to do …

Member Avatar for dean.ong.14
0
455
Member Avatar for glenwill101

With the exceptions of inline functions and templates, you do not want to have function implementations inside of a header file. You generally need to separate then out of the header and into a code file that will be compiled. Also, you want to use [#include guards](http://en.wikipedia.org/wiki/Include_guard) around the header …

Member Avatar for glenwill101
0
105
Member Avatar for chandnigandhi

You will, I suspect, find the online textbook [*The Craft of Text Editing*](http://www.finseth.com/craft/) quite useful for this purpose, if only because it gives examples for each of those tasks.

Member Avatar for Schol-R-LEA
0
91
Member Avatar for mmpal78

Have you tried using either string interpolation or the `.format()` method instead of string concatenation? subprocess.call('echo %s | festival --tts' % (line), shell=True) or subprocess.call('echo {0} | festival --tts'.format(line), shell=True) Also, if you are willing to use espeak instead of Festival, you might consider using [PyTTSx](http://pypi.python.org/pypi/pyttsx) rather than shelling out …

Member Avatar for mmpal78
0
269
Member Avatar for acerious

Uhm, first off, what language is this in? It certainly isn't standard C++, not unless you've been doing funny things with the pre-processor. Even that wouldn't explain the lack of semi-colons. Is this supposd to be in an actual language, or is it pseudo-code used to explain the algorithm?

Member Avatar for vijayan121
0
142

The End.