1,359 Posted Topics
Re: Start by declaring a class named `Rectangle`. Write a constructor (an `__init__()` method) that accepts arguments `self`, `length` and `width`, and assign the latter two to `self.length` and `self.width` inside the constructor. | |
Re: OK, I'll admit that the assignment is not well written at all. Still, it is not that difficult to work out the intended design, I think. Let's go over what you need to do: * Declare and initialize an array of `String`s; * Open the file for reading; * Read … | |
Re: Actually, tuples are mainly used by the Python language itself, for certain types of operations where lists would too slow, or where the immutability of tuples is helpful. For example, multiple return values are actually passed as a tuple, which can either be assigned as a single value or 'unpacked' … | |
Re: First off, you should be made aware that the forum software does not by default maintain the formatting of code; in order to get the code to stay formatted, you need to enter it using the 'CODE' button at the top of the editing window, else manually indent it by … | |
Re: I would start by adopting more consistent indentation practices; as it is, you're all over the place with your indentation. I'll try to get the code indented suitably for you so we can see where things actually lie. program TICTACTOE; {$APPTYPE CONSOLE} uses SysUtils; var Win,SaveMove,MoveTaken: Boolean; Board: Array [1..3,1..3] … | |
Re: First, please do not post new questions in existing threads someone else started, unless they are directly relevant to the discussion in the thread. Starting a new thread is much beter. Second, be careful not to double post when you submit your messages. Third, please try to be as clear … | |
Re: The problem you are having is three-fold. First, you are using the same names (`student_name`, `School`, and `Majors`) for both classes, and for the parameters to the to `Student_Track.__init__()`. Second, you are using the names of the classes in your print statement, rather than names of the instance variables (which … | |
Re: Displaying color is something which is system-dependent; there are no standard C++ libraries which have any concept of colors. What operating system (e.g., Windows, Linux, MacOS) is this running under? Which compiler are you using? Are you using the system routines (if any) or a platform-independent third-party library such as … | |
Re: Can you tell us what you are having difficulty with, please? | |
Re: I've tested your code (with GCC running under Code::Blocks) and found it to work, which indicates to me that the menu.txt file isn't in the same directory executable. Add the following test to you code right after the `open()` call: if(inData.fail()) { cout << "Could not open menu file. Stopping."; … | |
Re: > So basically I need to know for the gcc compiler, how did they manually set the ones and zeros in accordance to the execution environment when you need to know how the execution envirment executes binary. Just as a matter of note: strictly speaking, the GCC C compiler *doesn't* … | |
Re: Believe you misunderstood Ddanbe's point, I am afraid. The issue he was pointing out was not the use of the `switch()` statement; that was fine. The problem is that the variable you are testing, `symbol`, is never getting set to a usable value. You need to read in `symbol` after … | |
![]() | Re: OK, the description is a bit intimidating, but it's also very detailed. You just need to follow the instructions and it should be fine. Given that, can you tell us what you are having trouble with? It would also help if you could post your existing code, so we can … |
Re: Well, the instructor's hint at the bottom definitely seems to be the place to start, really. I would pick the `Individual` class first, as it is the simpler of the two; it's really little more than [POD](http://en.wikipedia.org/wiki/Plain_old_data_structure), with no methods other than maybe getters and setters. The `Factory` class is … | |
Re: Being the evil little Schemer that I am, I would like to mention a bit of a diversion in the form of a [lecture on Netwon's Method as written in a completely different language](http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/2a-higher-order-procedures/), using methods which would be difficult (though perhaps not impossible) in C++. You can find the … | |
Re: Please do not post offers of this sort here, especially in threads more than four years old. If you really feel an overwhelming need to help people cheat on homework, fine, that's your problem, not ours. If you want Freelancer.com, you know where to find it. | |
Re: First off, don't forget to `delete` all memory allocated using `new`. Second, if your intent is to print out the table, then you don't actually need the array at all, as `Array[x]` will always equal `x + 1` anyway. Third, as things are now, you are printing a single entry … | |
Re: Perhaps we should start by asking: 1. do you know how to compare two numbers, so that you can get the larger of the two? 2. Do you know what an array is, how to declare an array in VB.Net, and how to get an element from an array? 3. … | |
Re: To run a program or script that isn't in a path directory, you need to give at least a relative path to the file: $ ./filterList This tells bash where to find the script in question. | |
Re: If it is at all an option, I would recommend replacing Dev-C++ with [Code::Blocks](http://www.codeblocks.org/), a more up to date IDE with a similar interface and using the current version of GCC as it's default compiler. Not only does it avoid the problem you describe by keeping the console window open, … | |
Re: Can you show us what you have done on this project yourself so far? While we are happy to help you solve your problems, we will not simply hand you an answer without some effort on your part. To quote the DaniWeb community rules: >**Do** provide evidence of having done … | |
Re: First off, the statement makes no sense. What are 'manets'? What sort of trust calculations are used for them? Why do you need such calculations? And most of all, what have you done so far on the problem yourself? After a bit of searching, I am assuming you are referring … | |
Re: Before I get into your actual code, I have a few comments and suggestions to make. First off, get rid of Dev-C++ and get [Code::Blocks](http://www.codeblocks.org). Dev-C++ hasn't been updated in eight years, and the version of MinGW/GCC that comes with it is equally dated. You could update the version of … | |
Re: I think there is some confusion about the nature of operating systems going on here. That is natural, as much of the OS is hidden from view, while most of the things people think of as being part of the OS are actually separate programs (or at most sub-sections of … | |
Re: Well, fortunately, all you really need to do is change your `System.out.print()` calls to `.append()` calls on your `StringBuilder`: StringBuilder motCache = new StringBuilder(nombreLettres); for (i = 0; i < nombreLettres; i++) { motCache.append('.'); } (I hope that 'mot cache' is the correct phrasing for 'hidden word'...) You can then … | |
Re: Could you please clarify what it is you need for us? It sounds as if you are having difficulty with the input itself. Is that correct? Assuming that this is the case, then there are a few options you can choose. The simplest of these is to use [`scanf()`](http://www.cplusplus.com/reference/cstdio/scanf/) to … | |
Re: Does your professor require you to write your own Stack class? If not, then the `java.util.Stack` class would solve your issues right there. OTOH, stacks are easy enough to implement yourself; any linear data structure which allows you to add and remove an element from the same end (that is, … | |
Re: Could you explain the question a bit better, please? It isn't clear just what you are looking for, especially what you mean by 'execute first'. That last part sounds like your professor's instructions to you rather than a part of the question. I assume you are asking, how would you … | |
Re: The problem is that you are calling the `is_divisible()` function, and then, on a separate line, testing whether `True` is true, which will always be the case. What you want to do is call the function as part of the `if:` clause itself: primes=[] for n in range(2, N+1): if … | |
Re: It may also help to read up on [indent style](https://en.wikipedia.org/wiki/Indent_style) (also called [brace style](http://www.catb.org/~esr/jargon/html/I/indent-style.html)) to help clarify the issue at hand. There are several ways to format C++ code, all of which have their advantages and disadvantages; the most important things are that you use a style that is widely … | |
Re: 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 … | |
Re: Can you be a bit more specific about what is actually happening, then? Simply saying, 'This is not helping' gives us little to go on. #include <stdio.h> int main(void) { int n, prod, even; prod = 1; n = 30; for(even = 2; even < n; even += 2) { … | |
Re: I think you'll need to clarify things a bit before anyone can give you a helpful answer. Is your question about how you would call this function in general, or specifically about the difference between calling it in C and calling it in C++? I ask because, in most cases, … | |
Re: Oh dear, not this argument again :( It seems as if this argument flares up every three months or so, and frankly, it is purely a waste of effort. Let's first define our terms: a *programming language* is a language is capable of describing a sequence of actions for a … | |
Re: I have to agree with the consensus that as a practical skill, assembly language is not very useful. I would, however, argue that knowing something of assembly programming in general does help you understand some of the things going on inside of a compiled program, especially if you dig into … | |
Re: The problem is that, just as with division, taking the modulo of a number by zero is undefined; what you are actually getting is a division by zero exception, as internally, both division and modulo (or rather, strictly speaking, remainder) are calculated using the same assembly instruction. Thus, this is … | |
Re: Congratulations on finishing it, though once again, more detail on how you fixed it would have been appreciated. Also, just as a friendly reminder: when you do finish with the issue at hand, please mark the thread as closed, so that everyone knows you've solved the problem. TIA. | |
Re: Hint: assuming that your iterator variable is `i`, try using `i += 2` instead of `i++`. In other words, for (i = 2; i < final_value; i += 2) This will step you two values at a time istead of just one. | |
Re: I would mention *[Structure and Interpretation of Computer Programs](http://mitpress.mit.edu/sicp/full-text/book/book.html)* as a good starting place, but it's a controversial sugestion; on the one hand, it does an admirably job of covering programming in the small, starting from the ground up and moving alll the way through several complex topics. On the … | |
Re: **mukulnimker7751**: would you mind explaining the problem in greater detail, i.e., the circumstances in which you need to access the server this way? It would be much easier to help you if we had a better idea of what is actually going on; as things are we can only answer … | |
Re: Questions about OS development are a bit outside the usual range for this forum; you might want to try the OS Dev forums at [OSDev.org](http://www.osdev.org), as they are experts in the subject. Note that you need to tread lightly there, as they are rather rough with newcomers and do not … | |
Re: > Asking "What's the best programming language?" is much like asking "What's the best airplane?" - it entirely depends upon what you want to do with it. As Nelson-sensei once wrote, it is in some ways closer to asking, "What's the best religion?" Programmers often commit themselves to their tools, … | |
Re: How hard it will be depends on just how ambitious you are, and what languages and tools you intend to use. Is there a specific type of game you are considering learning how to make? As for where to find information, well, [GameDev.net](http://www.gamedev.net/page/index.html) is probably a good resource, as it's … | |
Re: Your second (output) loop has an inner loop that looks to have been intended to iterate through the five test values; however, you then unrolled that loop, making the inner loop unnecessary. The solution is either to eliminate that inner loop altogether: for (int a = 0; a < grades.length; … | |
Re: Several of us can help you, but you'll need to post what you've done so far. To quote [DaniWeb's forum rules](http://www.daniweb.com/community/rules): > Do provide evidence of having done some work yourself if posting questions from school or work assignments. As I said, we will provide assistance. We won't hand you … | |
Re: > give me ur email id and i will send it to u within 3 days Please, please, *please* don't post this sort of thing. Aside from the use of SMS-speak, and the fact that you are directly offering to help someone **cheat**, asking for someone's e-mail address is both … | |
Re: A few things to take note of: * First off, this code appears to be C, not C++. Perhaps one of the moderators can move it over to the correct forum? * There are two back-quote characters on line 13 that don't belong there. * Variable-length arrays have to have … | |
Re: **DarrelMan**: Did you mean to post this in the C forum? While it is certainly possible to write a shell in C++, most OS courses use vanilla C for such projects. If you *are* using C++, then you ought to be able to use the overloaded equality operator to compare … | |
Re: Uhm, all that `return` does is end the function. Since `command` is optional, not required, simply omitting the `command` keyword argument would do the trick. OTOH, if you think you absolutely need a function there (e.g., as a placeholder), you can use something like this: def empty_command: pass Which has … | |
Re: Assuming that you are creating a new file, then the simplest solution is just to name the file `testfile.html` to begin with: std::ofstream FileOne("c:\\testfile.html"); The C++ file I/O works the same no matter what the file extension is; a 'text file' is just a stream of bytes which is interpreted … |
The End.