1,359 Posted Topics

Member Avatar for suela

> can anyone help me to create a program that alows me to make a regular conversation with the computer? If anyone can, they should contact the Turing Award committee immediately... Seriously, this isn't anything even remotely trivial. Even a program like an [ELIZA](https://en.wikipedia.org/wiki/ELIZA)-class [chatterbot](https://en.wikipedia.org/wiki/Chatterbot) is a sizable project, if …

Member Avatar for Ancient Dragon
0
178
Member Avatar for RikTelner

Actually, what crackers 'hack' is mostly other people's impatience, ignorance and willingness to go along with percieved 'experts' and 'authority figures'. It's called [Social Engineering](https://en.wikipedia.org/wiki/Social_engineering_%28security%29) and it is the majority of how crackers circumvent both software and systems. Even software cracks such as program security exploits mostly depends on being …

Member Avatar for Coloradojaguar
0
358
Member Avatar for reuben_1

What sort of problem are you having, or trying to solve? We will need more information before we can give a sensible answer.

Member Avatar for vegaseat
0
180
Member Avatar for r.nair3456

As an aside, it should be mentioned that [cross-posting](http://forums.devshed.com/java-help-9/pls-advice-me-am-i-doing-right-by-proceeding-with-957181.html#post2921883) to multiple forums is generally frowned upon, as it leads to repetition of effort, and also clutters up the fora. If you feel the need to cross-post at all - and you almost certainly shouldn't unless you are certain that it …

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

If I may comment (even if it is a bit late), I would add a recommendation to apply named constants more extensively than you have. You have a number of places where you are using [magic numbers](http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Unnamed_numerical_constants) which are used repeatedly. It is good to get into the habit of …

Member Avatar for Schol-R-LEA
0
218
Member Avatar for Schol-R-LEA

In most modern languages, there are two fundamental approaches to repeating an action: either *iteration*, in which an action is placed inside a special-purpose structure which causes the action to be repeated, or *recursion*, in which a general-purpose function calls itself (or another function which in turn calls the earlier …

Member Avatar for Ancient Dragon
1
2K
Member Avatar for dosedt

There are two problems I can see in the code, the main one being that you are multiplying the odd numbers rather than adding them. You also have an extra pair of brackets around the body of the `main()` method, which isn't a syntax error, but does confuse things somewhat. …

Member Avatar for aanders5
0
179
Member Avatar for duskoKoscica

**duskoKoscica:** I think you will find [this post](http://forums.devshed.com/showthread.php?p=2001351#post2001351) helpful in clarifying why you should avoid having function implementations in header files.

Member Avatar for duskoKoscica
0
364
Member Avatar for tesfaye.mulu.71

*dusts off my boilerplate reply once more* 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 …

Member Avatar for Schol-R-LEA
0
3K
Member Avatar for joydsouza90

First off, please do not hijack threads from years gone by, even if they are related to your question. In the future, you would do better to start a new thread for your subject. Second, Turbo C++ has no direct support for modern fonts as far as I know, and …

Member Avatar for Ancient Dragon
0
4K
Member Avatar for Limiter

The good news is, there is a control structure in Scheme that can be used as either a break or a continue; the bad news is, it is really hairy, and not something you would want to use in most cases. The `(call-with-current-continuation)` function (abbreviated as `(call/cc)` in most implementations) …

Member Avatar for yawaramin
0
327
Member Avatar for priya.chitroda

> I do not know how to do that. Can you help Certainly. You may not realize it yet, but you *do* know how to write functions, or at least one special function, the `main()` function. `main()` is a special case, however, as it does a lot of extra things …

Member Avatar for james.opdyckeii
0
128
Member Avatar for Lp_baez

Actually, the `stdafx` header is specific to Windows, and to Visual Studio in particular. Most other C++ compilers are only going to have the Standard C++ libraries, plus whatever system libraries are used on that OS. Since MacOS X has FreeBSD as it's kernel, XCode should provide most if not …

Member Avatar for mike_2000_17
0
443
Member Avatar for Eric_8

I would further recommend re-writing the side() function by removing the user interaction, so that the function is responsible solely for computing the desired result: def pythagorean(first, second): ''' pythagorean(float, float) - Function to compute the length of a side of a triangle from the lengths of the other two …

Member Avatar for Eric_8
0
381
Member Avatar for merry gold

Well, yes, though this sort of project is really a great deal more complex than is likely to be easily resolved in a single post, or even an entire thread of posts. [This thread on Dev Shed](http://forums.devshed.com/other-programming-languages-139/compiler-writing-and-new-language-design-634985.html) is probably still a suitable starting place, especially the second post in it, …

Member Avatar for Schol-R-LEA
0
151
Member Avatar for aroshkhan

The line between 'helping you finish a project' and 'helping you cheat' is a fine one, at times. However, in this case the Daniweb rules are pretty straightforward: > Do provide evidence of having done some work yourself if posting questions from school or work assignments So: Show us what …

Member Avatar for Ancient Dragon
0
159
Member Avatar for richieking

The problem with this implementation is that it requires busy-waiting, something which presents a problem on multi-tasking systems. A proper `sleep()` function, one which passes control to the system scheduler and allows other processes to run, would not be portable between Windows and the various Unix-like systems. Moreover, while in …

Member Avatar for deceptikon
0
2K
Member Avatar for Builder_1

The [`strcmp()`](http://www.cplusplus.com/reference/cstring/strcmp/) function compares the ASCII values of the characters one by one. If all the characters match, it returns zero; otherwise, if the first differing character in the first string has a lower ASCII encoding than the compared character in the second string, it returns a negative, wheras if …

Member Avatar for Builder_1
0
7K
Member Avatar for Alya_1

I'm afraid we'll need more information about the problem you are having in order to give you any advice. Is this your own code, or was it provided by your instructor? Have you tried compiling and running it, and what was the result?

Member Avatar for Alya_1
0
291
Member Avatar for tiverton

Actually, Deceptikon, this is one place where C and C++ part ways; the C++ standard does require and `int` return value, and always has, whereas the older C standard recommends but does not enforce it. IIUC, the C11 has changed this to require an `int` return as well, even on …

Member Avatar for tiverton
0
264
Member Avatar for Mahesh_9

OK, there does seem to be some confusion here, and we may be able to guide you somewhat. First off, the assignment doesn't actually involve Notepad, or any other text editor for that matter, except perhaps for when you first create the file to be searched through. A text file …

Member Avatar for Schol-R-LEA
-1
145
Member Avatar for hassai

The simplest solution is to convert the first token (that is, the first contiguous series of characters) of each line to an integer, and sort by the integers. Given this approach, it would then make more sense to use an STL [`map()`](http://www.cplusplus.com/reference/map/map/), which automatically sorts itself according to a predicate …

Member Avatar for Schol-R-LEA
0
273
Member Avatar for abousetta

OK, first off, thank you for posting a message with a title other than 'C++ Code'. That is a first step, so credit where credit is due. OTOH, reposting the same question in three different threads in two different fora is not a good thing. Please try to stick to …

Member Avatar for Schol-R-LEA
0
357
Member Avatar for johans22

First off, you should never declare `main()` as `void` in C or C++; in C, `int main()` is the only portable form of the function, and in C++ (and the most recent C standard) it is actually required to return `int`. Now, with that nitpick out of the way, I …

Member Avatar for johans22
0
196
Member Avatar for Schol-R-LEA

I am currently working on a new language design in the Lisp family, which I am calling 'Thelema'. It is intended to be a multi-paradigm language which is related loosely to Scheme and, to a lesser extent, Common Lisp, but with modern concepts such as package management, support for object …

1
287
Member Avatar for dean.ong.14

Could you please explain your goal in this a little? We need more context to be able to give a meaningful answer.

Member Avatar for vegaseat
0
244
Member Avatar for hbhatti18

More to the point, the original post was over a month ago; presumably, the project was due already. In any case, it is unlikely that the 'bar code' the OP was reading was in a standard format, given the representation of the bar code as bars and colons.

Member Avatar for arronlee
0
635
Member Avatar for cambalinho

Would you mind explaining why you need to avoid template arguments in this? I would think templates would be the preferred approach for this, in C++.

Member Avatar for Ancient Dragon
0
224
Member Avatar for reloadmvp

Knowing assembly is also useful in debugging programs; being able to walk through the generated code with a debugger is a underrated but important skill. Compiler development also (usually) requires assembly language knowledge, for generating the target code. Aside from this, understanding assembly language gives significant insights to the actual …

Member Avatar for turboscrew
0
129
Member Avatar for pythonnewbie16

What is happening here is that you are defining the function at the point where you want to be calling it, but you never actually call it. You do *refer* to the function, on line 14 of the code above, but that is **not** a function call; without parameters, it …

Member Avatar for HiHe
0
931
Member Avatar for Schol-R-LEA

I would like to propose a link thread for posting listings of sites on CS topics not tied to a specific language. Two that come to mind as being relevant to some of the more common questions would be the [OS Dev Wiki](http://www.osdev.org), and the similarly themed but less established …

Member Avatar for sanjit.dasgupta2
1
355
Member Avatar for inspire_all

There is no need for look-ahead in this case; rather, once the analyzer begins a token that could be an identifier, it continues collecting the token's characters until it finds one that isn't a possible character in an ientifier token (e.g., a whitespace, or some symbol that isn't used in …

Member Avatar for inspire_all
0
180
Member Avatar for tinku.cater

Just to make what pyTony and Vegaseat said perfectly clear: **we won't do your homework for you.** To quote the DaniWeb Community Rules: > Do provide evidence of having done some work yourself if posting questions from school or work assignments We are here to help you become a competent …

Member Avatar for Gribouillis
0
280
Member Avatar for pythonnewbie16

The main things that jump out at me are: * line 4: there is an extra '(' at the end of the line. This was probably a typing error. * line 7: you dropped the colon at the end of the line

Member Avatar for pythonnewbie16
0
253
Member Avatar for Somee

I would start by writing a data file or database that holds the questions. Each question would have an identifier (a primary key), a difficulty level, a subject, a question, a set of four answers, and a marker indicating which answer is the correct one. I would then write a …

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

A few pieces of advice: * Never use certain letters for variable names, especially `l` (lowercase 'L') and `O` (uppercase 'o'). They are too easily misread as the numbers `1` and `0`, especially when scanning the code quickly. * Using a `for:` loop and then breaking down the values of …

Member Avatar for Schol-R-LEA
0
328
Member Avatar for cambalinho

> i have the windows.h include, but the 'L' where is declared? > or i must declare it? The prepend `L` is a feature of the C language itself, and is implemented inside the compiler; there is no definition for it. If you think it through, this has to be …

Member Avatar for cambalinho
0
146
Member Avatar for saurav2007

AD: I don't believe that Mike_200_17 is disagreeing with you about *where* static variables are kept, but rather about *when* and *how* they are initialized. He is saying that, unlike a globabl variable, which is initialized at the time the process running the program begins, `static` variables are initialized on …

Member Avatar for Ancient Dragon
0
280
Member Avatar for kelvin.njuguna

The problem here lies in the order you are doing things, and I suspect in a conceptual error that is fairly common among new programmers. When you are declaring and initializing the variable `userInput`, the values of `c1` and `c2` have not yet been set, so the values passed to …

Member Avatar for Schol-R-LEA
0
298
Member Avatar for cambalinho

The `istream` and `ostream` classes work with `char`s, rather than `wchar_t`s, and won't interpret wide chars correctly. However, changing them to work with `wchar_t` would break a large amount of existing code, so they have to be retained for backwards compatibility. Naturally, the standards commitee wanted to provide a portable …

Member Avatar for cambalinho
0
104
Member Avatar for bradley1234

Assuming your goal is Run-Length Encoding, you need to have some way of marking the places where you've applied the encoding, preferably with some character that would never appear in the data stream, or else one that is rarely used. Assuming that your data is always going to be integers, …

Member Avatar for Schol-R-LEA
0
105
Member Avatar for woomar

If you don't mind me asking, is there a particular reason why you do not want to use an iteration? Is this a class assignment, or just curiosity on your own part? Also, I assume that this is *not* a class implementing the standard Java `List` interface, so we would …

Member Avatar for woomar
0
242
Member Avatar for ZombieKnight93

OK, before you go on with this, cosider for a moment: is a `Quadrilateral` an example or special case of a `Point`, or does it *have* points as its properties? If the latter, how many `Point`s do you need to represent the `Quadrilateral`, and how many `double` values are you …

Member Avatar for Schol-R-LEA
0
641
Member Avatar for dreking6

What have you tried so far? Please show us the existing code, if any. Note that, chances are, you are going to have to rad the whole file into memory (or at least the part from where you are editing it onwards) and write it back to the file. You …

Member Avatar for dreking6
0
621
Member Avatar for renagadejesus

Setting aside the questionable wisdom of this design approach, the question becomes, what have you done with it so far? As stated in the [DaniWeb community rules](http://www.daniweb.com/community/rules), we will only help you if you first demonstrate some effort on your own part. Post some code, or a specific question, and …

Member Avatar for Moschops
0
269
Member Avatar for surya.putra.94849

To start with, what version of [Turbo Pascal](https://en.wikipedia.org/wiki/Turbo_Pascal) are you using, and is it an old (DOS console) version of something at least from the Windows era? THe name 'Turbo Pascal' was superceded by '[Delphi](https://en.wikipedia.org/wiki/Embarcadero_Delphi)' (a Pascal compiler and IDE for Rapid Application Development) in the mid-1990s, hence the question. …

Member Avatar for surya.putra.94849
0
518
Member Avatar for talat.zaitoun

I ran the code, and while it didn't print in the manner you probably would like, it does indeed multiply the matrix by a scalar. What problem are you experiencing with it? First off, the name `matrix()` for this isn't really appropriate; it's matrix *multiplication*, whereas the name `matrix()` makes …

Member Avatar for Schol-R-LEA
0
166
Member Avatar for Vasthor

[This posting](http://forums.devshed.com/showpost.php?p=2001351&postcount=14) may help explain why it is (generally speaking) a mistake to include functions in a header, and what headers are mainly used for in the first place.

Member Avatar for Schol-R-LEA
0
129
Member Avatar for Owais Madakhail

Sure. Got ten years or so to spare? More seriously, this question is far too broad to be easily addressed. If I were giving advice, I would start with something like the MIT Open Courseware [Intro to Computer Science and Programming](http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/), which gives a good starting point in Python (a …

Member Avatar for Schol-R-LEA
0
121
Member Avatar for jal pari

Because the goal of DaniWeb is to help you become a better programmer, not to give you a passing grade you don't deserve. As the [DaniWeb Community Rules](http://www.daniweb.com/community/rules) state: > **Do** provide evidence of having done some work yourself if posting questions from school or work assignments By posting here, …

Member Avatar for tinstaafl
0
184

The End.