1,359 Posted Topics

Member Avatar for techy50

I'll put my two cents in by repeating my [earlier recommendation](http://www.daniweb.com/software-development/c/threads/426970/need-to-improve-my-programming-skills#post1827177) in a similar thread: Try walking through the process outlined in [Scheme from Scratch](http://michaux.ca/articles/scheme-from-scratch-introduction). It is a few weeks of work for the basic implementation, but it is always possible to continue refining it. If that's too much right …

Member Avatar for Schol-R-LEA
0
238
Member Avatar for Tony13

Finding a favorite language is a bit of a personal experience, so it's hard to give exact advice. While a part of me still wants to plump for [Scheme](http://www.schemers.org/) (and specifically *[Structure and Interpretation of Computer Programs](http://mitpress.mit.edu/sicp/)*, a classic introductory textbook that is available online), I have to second the …

Member Avatar for dawidbrook
0
156
Member Avatar for shibu2all

That depends on a) the operating system (and window manager) you are using, and b) whether you are free to use third party libraries. There are no C standard libraries that address graphics, or indeed any form of I/O other than buffered streams; however, there are many different [3rd party …

Member Avatar for Schol-R-LEA
0
157
Member Avatar for valestrom

Pardon the thread necromancy, but I can't help but mention a famous bit of hacker lore regarding a programmer working in pure binary (well, hex actually, but still) in the 1960s - [The Story of Mel, A Real Programmer](http://www.cs.utah.edu/~elb/folklore/mel.html). (And yes, [Mel Kaye](http://en.wikipedia.org/wiki/The_Story_of_Mel) was a real person; the story is …

Member Avatar for ModernC++
0
2K
Member Avatar for priya.chitroda

Minor point, but the correct [`printf()` format string specifier](http://www.cplusplus.com/reference/clibrary/cstdio/printf/) for a pointer value is `%p`, which will show it in the correct format for a pointer on the given platform. While `%x` will show that value as a hex number, this isn't necessarily the *correct* way to specify a pointer …

Member Avatar for WaltP
0
242
Member Avatar for kuchi

Let's see if you I have this correct. You have a web page with a server-side Python script which extacts data from a database and is supposed to pass it on to the client. On the client side, you need to have a dialog box come up and request a …

Member Avatar for kuchi
1
762
Member Avatar for jrmeasures

With an 8-bit division, the dividend is held in `AX`, with `AH` being the high bit and `AL` being the low bit (naturally enough). This means that you need to have a suitable value in both `AH` and `AL` before dividing. In this case, since you are only dividing one …

Member Avatar for Schol-R-LEA
0
2K
Member Avatar for txikiting

A `WORD` value is a 16-bit unsigned integer type used in Windows. Since it is actually only a `typedef` of `unsigned short` under the current Microsoft VC++ library, Assuming you are using standard C++ strings, it should be possible to use an [`stringstream`](http://www.cplusplus.com/reference/iostream/stringstream/) to convert it to a `string`. std::stringstream …

Member Avatar for Schol-R-LEA
0
401
Member Avatar for godzab

The shell command you are looking for is `g++ filename -o executablename`, or at least that will get you started (the '-o' stands for 'output', and let's you choose the name of the final executable). Look up the documentation on [GCC](http://gcc.gnu.org/) and [make](http://www.gnu.org/software/make/) for more involved compilation.

Member Avatar for godzab
0
646
Member Avatar for gizmo7008

You could eliminate a certain amount of redundancy by using [`toupper()`](http://www.cplusplus.com/reference/clibrary/cctype/toupper/) (defined in the `<cctype>` header) to force the user input to upper case: int userChoice() { char choice; int choice2; do { cout << "Please enter your choice[r,p,s,q]: "; cin >> choice; choice = toupper(choice); cout << "Human: " …

Member Avatar for gizmo7008
0
901
Member Avatar for Denise23

What is the problem you are having? This looks like a legitimate assembly program fragment (assuming you are using EMU8086 or a DOS box of some sort), but not exactly a complete program. The biggest issue I can see is that it doesn't compute what your supposed to; this takes …

Member Avatar for ShiftLeft
0
110
Member Avatar for pkaramagi

My initial impression is that this is in a serialization format known as [JSON](https://www.google.com/search?q=JSON) (JavaScript Object Notation). However, it has additional characters - 'D's and 'H's - following some of the fields. Also, knowing the format doesn't tell you much about the specific meaning of the fields. Sorry I couldn't …

Member Avatar for Schol-R-LEA
0
512
Member Avatar for nheshen

Could you show us what you have so far, or at least the part where you check for the substring `" my "`? Generally speaking, you want to simply take the tokens or words following "my", whatever they happen to be.

Member Avatar for Schol-R-LEA
0
367
Member Avatar for fatimah batool

That seems a reasonable assumption, though I'd want to hear back from the OP before assuming that this is what is needed. In the meanwhile, here are some comments I cann make based on the code itself: + You included the `<iostream>` header for the C++ style I/O, but used …

Member Avatar for Schol-R-LEA
1
200
Member Avatar for lxXTaCoXxl

At what point to do you set the random seed? I don't see any calls to `srand()` in the `Random` class, which means that the sequence of 'random' values will always be the same. You can solve this issue by adding a class integer variable `seed` and a static initialization …

Member Avatar for histrungalot
0
208
Member Avatar for sebass123

The problem is fairly straightforward, and is exactly what the error message says: in both of the functions, you declare `i` and `j` as type `float`, which is not an integral type - that is to say, it isn't a type which holds only integer values, such as `int`, `short`, …

Member Avatar for sebass123
0
118
Member Avatar for speakon

On the card values, I would recommend using a `HashMap` as a reverse lookup table for the card face values. Something like this should do: private HashMap<String, int> faceValues = new HashMap<String, int>(20); faceValues.put("Ace", 1); faceValues.put.("Deuce", 2); faceValues.put("Trey", 3); // handle all the numbered cards for (int i = 4; …

Member Avatar for speakon
0
1K
Member Avatar for poloblue

The immediate problem actually lies in `avgs()`; what is happening is that, since you aren't generating any negative numbers, `negNums` is zero, which means that when you go to get the average of the negative numbers, you cause a divide-by-zero error. Since this is a possibility even when correctly generating …

Member Avatar for poloblue
0
330
Member Avatar for ashish karna

Not really; the two programs work in ways that aren't really compatible with each other, and if you'd written either of them yourself, you'd realize why that is the case. The first doesn't actually calculate anything; it just generates a second program that does the computation, then deletes the second …

Member Avatar for TrustyTony
0
176
Member Avatar for txikiting

First, permit me to re-post the code with suitable indentation, courtesy of [Astyle](http://astyle.sourceforge.net/): #include <iostream> #include <cstdlib> #include <cstdio> #include <ctime> #include "windows.h" using std::cout; using std::endl; bool ListDirectoryContents(const char *sDir) { WIN32_FIND_DATA fdFile = {0}; HANDLE hFind = NULL; ULONGLONG fileSize; time_t rawtime; struct tm * timeinfo2; long bsize; …

Member Avatar for txikiting
0
222
Member Avatar for triumphost

I've run across this before, and the short answer is: you can't. DLLs were designed originally with the Pascal language in mind, and as a result, older 16-bit DLLs often used the Pascal parameter passing conventions. By the time Win32 came on the scene, Pascal was largely forgotten, but, Visual …

Member Avatar for mike_2000_17
0
2K
Member Avatar for aasi007onfire

That this is undefined behavior isn't a matter of any debate or opinion; it is defined as such by the language standard, as WaltP stated more than 4 years ago. Could someone please close this thread?

Member Avatar for deceptikon
0
277
Member Avatar for alaa sam

Sneaky little Schemer that I am, I'll throw in [Scheme from Scratch](http://michaux.ca/articles/scheme-from-scratch-introduction), a project to write a simple Scheme interpreter in C. While Peter Michaux has posted his own code for it, there are several others who followed along the basic design with their own implementations (in a fit of …

Member Avatar for madelinekim
0
325
Member Avatar for brunoccs

The reason for the macro expansion of `add` in this instance is because of [how the immediate instructions encode the immediate values](http://www.student.cs.uwaterloo.ca/~isg/res/mips/opcodes). The actual 'add immediate' instruction, `addi`, is a single 32-bit value which encodes the instruction opcode itself, plus the two register arguments, *and* a 16-bit immediate value. | …

Member Avatar for Schol-R-LEA
0
502
Member Avatar for poloblue

*jaw drops* You'll **need** help if this is the way you're being taught how to do things. You don't even know how much you need it. If you don't mind me asking, has your coursework covered basic data structures - using either `struct` or `class` - yet, and if so, …

Member Avatar for poloblue
0
147
Member Avatar for elyos

First off, it isn't in most cases necessary to enter into the Python console itself to run a file; you can instead just open a system console window and use python Server.py and the program should run. For that matter, if you are running Windows, the file assocations should automagically …

Member Avatar for elyos
0
297
Member Avatar for hwoarang69

As an old hand there in days gone by, I would warn you that the regulars at the [OSDev Forums](http://forum.osdev.org/) don't suffer fools or newbies. It's an excellent resource, but if you do post there, be on your toes, use your clearest proper English, and do everything you can ahead …

Member Avatar for Schol-R-LEA
0
247
Member Avatar for HankReardon

We generally prefer to have everything posted publicly, so that others can benefit from it. If you post your code, we'll try to help you with it. On the other hand, if you really don't wish to have your code out for anyone to see, you can PM me or …

Member Avatar for TrustyTony
0
104
Member Avatar for HTMLperson5

It would help us considerably if you'd give us some idea of your goals, your design ideas, and your purpose in this. Is this solely as a learning experience, you do you have a particular application in mind for this new language? Have you done any work on designing the …

Member Avatar for HTMLperson5
0
1K
Member Avatar for silvercats

Asking questions isn't a problem. Answering them is what we're here for, after all. The answer to both of those questions is the same: In C++, all executable statements have to be inside of a function. Declarations and directives do not fall into this category, but function calls do. In …

Member Avatar for silvercats
0
874
Member Avatar for poloblue

In `grading()`, you declare `hw1`, `hw2`, and so on, but never assign any values to them before you use them. This means that they will be filled with whatever garbage happened to be in memory before the function was called.

Member Avatar for poloblue
0
1K
Member Avatar for Flowerlady

Setting aside issues about your Belief System (since I am no one to talk, given that my own BS is far stranger), I would mention that at least some 64-bit Intel chips have built-in entropy sources that can be accessed with the RDRAND instruction. On Macs which have this instruction, …

Member Avatar for mike_2000_17
0
140
Member Avatar for brunoccs

If this is the formula for [power consumption on a CMOS circuit](http://www.siliconintelligence.com/people/binu/perception/node13.html), then yes, though you are missing part of the equation (the Activity Factor, which represents the fraction of the circuit that is actually bearing a current); as it is, it's only correct if the whole circuit is active, …

Member Avatar for Schol-R-LEA
0
81
Member Avatar for salmansaifi7

This issue is simple: you are trying to `append()` a `NULL` pointer, which (depending on how your `append()` function works) will either return an error or silently fail, as a `NULL` node is the same as not appending a node at all. In order to actually append a new node, …

Member Avatar for Schol-R-LEA
0
186
Member Avatar for salmansaifi7

Whenever any function is called, the arguments are evaluated first, and their results are the actual working arguments. In this case, the string concatenation is performed first, then the whole string is passed to the function. So, if i = 50, then the string passed to `System.out.println()` is `"Hi...50Welcome"`. In …

Member Avatar for Schol-R-LEA
0
81
Member Avatar for daino

There really aren't any specific rules about making wrapper casses I'm afraid; it depends too much on the functions and structures which are being encapsulated. Some wrapper classes are nothing more than a static class with a group of methods that call the original functions directly being nothing more than …

Member Avatar for daino
0
4K
Member Avatar for Cap'nKirk

I would recommend using a [color picker control](https://www.google.com/webhp?q=color+picker+control) rather than a combobox, if only for the compactness of the design.

Member Avatar for Cap'nKirk
0
125
Member Avatar for sparsh610

What it comes down to is that `sizeof(struct node)` gives the size of a `struct node` element, while `sizeof(struct node *)` gives the size of a **pointer** to a `struct node` element. So, if `struct node` is struct node { int data; struct node* next; } Then, on a typical …

Member Avatar for mike_2000_17
0
84
Member Avatar for sparsh610

There is another approach to this, which would not require you to rebuild the list; however, the technique needed is not that different from that used to reverse the list, so which would be the most useful would depend on the overall goal. In essence, what you would do is …

Member Avatar for mike_2000_17
0
852
Member Avatar for brunoccs

The book _[Linkers and Loaders](http://www.amazon.com/Linkers-Kaufmann-Software-Engineering-Programming/dp/1558604960/ref=sr_1_1?s=books&ie=UTF8&qid=1340689296&sr=1-1&keywords=linkers+and+loaders)_ by John Levine ([available online](http://www.iecc.com/linker/) in a beta version) is an excellent resource in this regard. It gives details about several of the most common file formats (though for better or worse, the book does not cover Mach-O, the Mach kernel format used by MacOS). …

Member Avatar for brunoccs
0
301
Member Avatar for poloblue

I think you've misread the assignment somewhat. The initial loop for entering in the array values is good, but you are misinterpreting what is meant by 'in the array'. What you need to do is declare another `int` value - let's call it `testNumber` - and read in a value …

Member Avatar for poloblue
0
139
Member Avatar for RonKevin

**Branickiod:** I think you are confused. This is the C++ foru, not the SQL Server forum, and the text you quoted isn't relevant to the matter at hand in any way, shape or form. I know you meant well, but please pay more attention to where you are posting in …

Member Avatar for RonKevin
0
264
Member Avatar for txhornsfan

Odd, I was able to get it to run correctly without any changes (under MinGW GCC 4.4.1). Which compiler are you using? BTW, the use of the negative operator on zero is has no effect; zero is neither positive nor negative. HTH.

Member Avatar for Lucaci Andrew
0
222
Member Avatar for phorce

That depends, I would say, on how you mean to use the two methods. Personally, I would probably have only one form of the method, one which takes an `istream&` as it's argument; this covers both the case of a file input (`ifstream&`) and string input ([`istringstream&`](http://www.cplusplus.com/reference/iostream/istringstream/)), and gives you …

Member Avatar for phorce
0
187
Member Avatar for Gen.Asura

Take a look at _[Head First Java](http://www.amazon.com/Head-First-Java-2nd-Edition/dp/0596009208/ref=sr_1_1?ie=UTF8&qid=1340641317&sr=8-1&keywords=head+first+java)_, if you have the opportunity to do so before buying it. It seems to be a book people either love or hate; The style of is offputting to many, but those who can get into it without being overly distracted often find it …

Member Avatar for Krokcy
0
129
Member Avatar for poloblue

And what seems to be the trouble with it? I can see that it is incomplete, but you will need to spell out just what you need help with. Seriously, PoloBlue, you have been posting here long enough that you should know better than this by now. We are not …

Member Avatar for poloblue
0
7K
Member Avatar for Remy the cook

Well, first off, regarding the libraries you've included, I would recommend using the C++ versions rather than the C-style names. All standard C++ headers now omit the '.h' extension, and for the older C headers, prepend them with the letter 'c'. Thus, `<stdlib.h>` should now be `<cstdlib>`, `<string.h>` should be …

Member Avatar for Remy the cook
0
180
Member Avatar for Monster99d

In this case, the error is most likely in one of the header files you are including, with the most probably cause being that you omitted a semi-colon at the end of a class definition.

Member Avatar for Monster99d
0
4K
Member Avatar for deepthought

The simple answer for why `b` is not defined in this loop: while b <= 10: print (b) b += 1 is that `b` is not, in fact, defined, at least not when you are trying to compare it to 10. Thus, you do indeed want to initialize it to …

Member Avatar for deepthought
0
8K
Member Avatar for RonKevin

First off, while it isn't relevant to your particular issue, I would recommend against using `void main()`. According to the C++ standard, the only valid return type for `main()` is `int`, and while some compilers do accept other return types, it is strictly non-portable. Speaking of non-portable, the `<conio.h>` library …

Member Avatar for RonKevin
0
319

The End.