1,359 Posted Topics
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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: " … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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`, … | |
Re: 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; … | |
Re: 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 … | |
Re: 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 … | |
Re: 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; … | |
Re: 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 … | |
Re: 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? | |
Re: 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 … | |
Re: 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. | … | |
Re: *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, … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
![]() | Re: 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 … ![]() |
Re: 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 … | |
Re: 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. | |
Re: 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, … | |
Re: 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, … | |
Re: 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, … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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). … | |
Re: 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 … | |
Re: **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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … |
The End.