- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 52
- Posts with Upvotes
- 49
- Upvoting Members
- 42
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 4
Typical software development nerd. Over-educated, perhaps. I'd rather be helping others with their programming difficulties than actually accomplishing anything of my own. Which is why I'm here. Your problems fascinate me, my own are boring. :)
- Interests
- Hiking, cycling, attending live music/theater productions, spending time with my son, staring at the…
- PC Specs
- Aging Shuttle form-factor box with Ubuntu installed, currently powered down. Two employer-provided laptops:…
364 Posted Topics
Re: What is the question? And is this supposed to be C++ code, or Java? "P U Q" is normally called a "union", not a "sum". I'm not sure why you keep checking that elements of multiset are not zero in sum(), intersection() and difference(). Zero is a perfectly reasonable value, … | |
Re: [CODE] bool keep_running = true; while (keep_running) { // do program stuff // prompt whether to keep running // handle response } return 0; [/CODE] | |
Re: What happens if you input -6? It looks to me as though your program will tell me it's odd. Try thinking through your problem out loud. If you can tell yourself logically how it should get to the answer, you should be able to program it correctly. For starters: "If … | |
Re: Can you clarify "get no result"? Were you able to build the executable? If so, did you get any error messages when you ran it? If it doesn't print anything to the console (assuming you're running it in a console window), did it occur to you that it might be … | |
Re: Not to pry into your personal business, but why would you want to do this, besides to spam somebody else's site? If you've been tasked with data entry to pre-populate a website, it would make more sense to enter the data into the back-end of the website, rather than through … | |
Re: for ghosts, i'd start with the simplest thing first, and get that working. pseudocode: [CODE] next_ghost_pos = updateGhostPos(); while (next_ghost_pos == wall) { ghost_direction = rand() % 4; next_ghost_pos = updateGhostPos(); } ghost_pos = next_ghost_pos; [/CODE] This will have a ghost move in one direction until it hits a wall, … | |
Re: Since you are new, suquan629, I'll offer a couple of pointers (no pun intended): 1. You don't need to memset the array to 0 since you've allocated it to be exactly as long as you need 2. Since this is a learning exercise, don't use strcpy(), instead use a loop … | |
Re: I'm not going to go into the code you "found" that does some of what you want. The purpose of the assignment is to write your own, starting with an understanding of what you are trying to accomplish (or what your friend is trying to accomplish, as the case may … | |
Re: Each variable has both an address and a value. After line 3 above executes, you have: * a (address = 0xFF2A, value = 32.5) * b (address = 0xFF2E [since each `float` takes 4 bytes], value = unknown [`*`]) after line 4 executes, you have: * a (address = 0xFF2A, … | |
Re: I'd like to start with your looping structure. At line 18 above, `if (baris == 1)`, since this is after the loop of baris over the range [0, bintang) is done, baris can only be 1 if bintang was also 1. And bintang == 1, looking at the outer loop, … | |
Re: > Base from what I read so far > 1. the image is divided into 8x8 sub-blocks > 2. then DCT is applied to each of the sub-blocks. I'm stuck here what happens next? What happens next is specific to the image-file-format. For instance, for lossy compression in the JPEG … | |
Re: I want somebody to do all my work for me too. But that's not how it works here on DaniWeb. Here, **you** write the code, and if there's something you don't understand, or if you're stuck on a particular point, you post the code you've written so far, along with … | |
Re: int num_rows = 10, num_cols = 2; int row, col; // allocate: a set of rows, then the set of columns for each row int **vals = new int * [num_rows]; for (row = 0; row < num_rows; row++) vals[row] = new int [num_cols]; // delete what you allocated, in … | |
![]() | Re: I suspect your error is a "Segmentation Fault", which typically results from trying to access an uninitialized (or already deallocated) pointer. With any luck your "some processor fault error" message actually includes a specific error code number, and maybe even the line of your program where the error occurred. That … |
Re: > // I have no idea what goes in the constructor Do you have some idea what the members of the class will be? So far, you haven't specified any. Also, your constructor and set() methods should not be private, otherwise there's no way for any code outside of the … | |
Re: You haven't failed. You just haven't gotten to the answer yet. I don't think the project is necessarily beyond what you've learned so far. If you have categories, then each category contains an array of words. If the number of words is **up to** 7, then each category must also … | |
Re: Hi Nathaniel, excellent work over all. (Sorry to be jumping in here, but that's how it works some times!) Line 75 in your Delete() method is almost certainly not what you meant (though it looke like line 77 is good). What does it mean if Previous_ptr is NULL, and what … | |
Re: Please write complete words. Your txting shorthand makes my brain hurt. The first thing I see is within your `main()` in main.cpp, you're recursively calling `main()`. Don't ever do that; a number of compilers won't even compile it. `main()` is the entry point from the operating system into your program. … | |
Re: When you copy the elements of list1 into list2, you're copying the pointers to the FileInfo objects, so that `list1[i]` and `list2[i]` both point to the same allocated FileInfo instance. Either create a copy-constructor FileInfo(const FileInfo &other): a(other.a), b(other.b), ... {} or make your lists of `<FileInfo>` instead of `<FileInfo … | |
Re: In test2, where it fails to find the value of 40 in the node after 30, print out what it **did** find (or "no next node" if is_item() fails). Same for other tests. A useful debug method might be `printEntireList()`, which can avoid using the other methods (so as not … | |
Re: Ignoring the fact that you define, but don't call, `enter_password()` and `enter_name()` functions ... at line 25, you get some input and assign it to variable `pwrd`, but at line 26, you're trying to check the value of variable `input` which you haven't assigned at all. And the way you … | |
Re: At line 232 above, you're always reading into the 1000th position of the array, which doesn't even exist (valid indices are from 0 to 999). I think you meant `&customer[track]`. Then at line 255, you're trashing your value of track by assigning to it the value of getche(). Use a … | |
Re: Looks like you might need to write your own, if you need full RTF support. See [wikipedia](http://en.wikipedia.org/wiki/Rich_Text_Format), especially the "Implementations" section for an idea of where to look for help. | |
Re: In at least two places, your for() loop looks like this: for(int location = 0; location > tableSize; location++){ I think you mean `location < tableSize;`. | |
Re: Instead of `if (inputFile)`, try `if (inputFile.is_open())`. And when posting your code, please select all of it and click the **Code** button at the top of the editor, or just hit the tab-key to do the same thing. Then all of your code will get line-numbered and formatted together, instead … | |
Re: Let's start simple. Do you understand Part 1 of the assignment? Can you code that much up and see if it will compile? Then can you use create an instance of the class, use the setters to populate the instance, and the getters to verify the values? Third, add a … | |
Re: This should get you started: template<class Datatype> class DListNode { public: //********Member Variables******** Datatype m_data; DListNode<Datatype>* m_prev; DListNode<Datatype>* m_next; //*********Methods******** ... }; | |
Re: Usefulness, like beauty, is in the eye of the beholder. The most useful program you can write, to practice the basics, is one that would be useful to **you**. Write your own address-book / contact-list program, that lets you store and find the info you want **your** way. Own a … | |
Re: I'm not entirely sure, but if you're working in Visual Studio, it gets very fussy about the definition of main(). I'd recommend creating a new project of the desired type ("Console Application" is probably best), and then including "Planet.h" and any other additional includes at the top, and pasting the … | |
Re: Looks like you're off to a good start. I believe operator==() is generally expected to return type bool, rather than int, so you could just do: return this->from == other.from && this->to == other.to && this->weight == other.weight; But I think it'll work as-is. | |
Re: Instead of having your `order` class look a lot like an individual `product` (but with different names for the members), have it encapsulate the array of desired `product` instances selected by the user. Using the same idea, you could wrap your `arrayp` from main() in a `catalog` class that encapsulates … | |
Re: This is almost certainly a visual indication that the checkbox (or radio-button) now has keyboard focus (meaning that the space-bar will toggle the state of the checkbox, or select an unselected radio button -- hitting the tab key to move the focus among widgets should confirm this). If you don't … | |
Re: At line 102, you're resetting y1 in terms of j, regardless of the value of i. You can simplify a great deal of your code by changing where you update values, and noticing something about how the squares alternate: for (i=1; i<=8; i++) { // adjust y2 to match y1 … | |
Re: The same thing happens on the stack with recursion as with any other function call. In this case, when you first call `node * root = t.create()`, a frame is added to the stack with space for the returned `node*` and the address of the following instruction to return to, … | |
Re: Funny, to me, it looks like very clearly written instruction in how to use the *markdown* language for minimal in-line formatting. Or, for the more GUI oriented, you could just select all your code lines using the mouse, and click the **Code** button along the top of the editor, it … | |
Re: Your sorting code in main() looks close, but as doomilator suggests, move it into the Sort() routine. Then initialize j = i->NEXT and loop while j != NULL (otherwise you're needlessly comparing i to itself the first time, and never checking the last element in the list). Also, your comparison … | |
Re: Please use the **Code** button above the editor to maintain formatting of and line-number your code. The error is a missing `*` before `Health` in the first line of `class Player`. That said, why do you want the inefficiency of all those pointers to integers for your class members? Just … | |
Re: For case 'e', how are you adding the new info into your list? For case 'l', how do you plan to iterate over your list and display each contact? And obviously case 'f' needs work. Since I don't know specifically where you're stuck, I suspect the problem is that you're … | |
Re: I've been working extensively with Python and Qt via the PyQt bindings from Riverfront. First of all, an "object" doesn't throw an exception, code associated **with** the object does. So what you may want to encapsulate in a try/catch block is any method call on the textEdit. The constructor almost … | |
Re: You need to determine whether the 1D version of the matrix is in row- or column- major order. Also, whether the matrices are designed to be applied in prefix or postfix order. These are more or less the same question. I prefer to think of matrices as I learned them … | |
Re: Sounds like a take-home quiz. Good luck with that. Google is an amazing search tool. | |
Re: A great place to start is the "Read Me: Read This Before Posting A Question" item at the top of the forum listing. Since we're not mind-readers, and can't see your screen from this far away, we don't know what you've attempted, nor what specific failures resulted. Can you prompt … | |
Re: The code isn't even correct as written, but what the line in question says is: * take the argument `ss`, which is a const-reference to the passed object (meaning we're promising not to change the original object, even though we're looking at it) * use the `&` operator to create … | |
Re: I'm not positive, but it sounds like you're unclear on classes, and "object-oriented-ness" in general. For a case as simple as yours, an Object can be thought of simply as an abstraction of a real world object. Specifically a "product". Objects contain their attributes ("members") and most basic actions ("methods"). … | |
Re: Since it's been a day or so, I'll jump in! The "x-1" you've seen is part of the process of shuffling an array, which isn't part of this assignment. The reason it exists, if you look back to your earlier code sample which shuffled the song list, is because by … | |
Re: As far as storing values in a file (or in a database on a server), it's a good idea to use an encryption scheme to store something like a password. You can't make the file otherwise readable to your program, but unreadable to everyone else. And if you could, you … | |
Re: I don't see where you implement the methods sepcified in Resistor.h. Instead, you've implemented two standalone functions, and then provided prototypes for them in ResistorMain.cpp. Meanwhile, you have code that tries to create a new resistor object by passing what appears to be a nominal-resistance, a percentage tolerance, a name … | |
Re: [QUOTE]error C3867: 'cc_real::Form1::WaitForMessage': function call missing argument list; use '&cc_real::Form1::WaitForMessage' to create a pointer to member[/QUOTE] So did you try what it says? At line 232 above, replace [CODE] SdbCreateThread(WaitForMessage, 0); [/CODE] with [CODE] SdbCreateThread(&WaitForMessage, 0); [/CODE] As far as I'm aware, each is equivalently "a pointer to the function", … | |
Re: That number of collision-tests shouldn't be bad. Most of "efficiency" involves a priori knowledge of what's going on. For example, if the ground stays flat and your players start above the ground, and are supposed to stay there, then you can use a simpler collision: just make sure each player.y … |
The End.