Forum: C++ Jan 20th, 2009 |
| Replies: 6 Views: 521 Just tested it with the changes mentioned, and it works for me too. |
Forum: C++ Dec 26th, 2008 |
| Replies: 4 Views: 671 Here are another 2 options:
1) Make a copy of the array, and do only a partial selection sort. Use the variation of selection sort that puts the largest element at the end. Since you only want the... |
Forum: Java Dec 16th, 2008 |
| Replies: 7 Views: 654 If your SoapPair class has any member variables, all of them have to be of a type that is serializable. |
Forum: C++ Dec 16th, 2008 |
| Replies: 4 Views: 549 Your instructor's feedback is extremely straight forward...
Also he did miss some things:
- The US dollar to English pound conversion in your code is incorrect, take a closer look at the conversion... |
Forum: C++ Dec 12th, 2008 |
| Replies: 2 Views: 1,255 1. recv() will NOT necessarily receive all the bytes sent in one call. You will have to loop it. Since recv() returns the number of bytes received, what you can do is have the sender always put an... |
Forum: Java Dec 10th, 2008 |
| Replies: 4 Views: 425 The panel class needs a reference to your frame class. Assuming your frame class creates the panels, the frame should send a reference to itself (this) as an argument to the panel constructor. You... |
Forum: Java Dec 10th, 2008 |
| Replies: 2 Views: 403 I would argue that the majority of code people write is iterative rather than recursive. Because recursion has more overhead in terms of memory and speed, iterative approaches are generally preferred... |
Forum: C++ Dec 9th, 2008 |
| Replies: 1 Views: 306 Instead of: int board[4][4];
Replace with: int** board;
Now we can dynamically allocate space for the 2D board array.
In set_board(), we need to do the dynamic allocation like so:
// First... |
Forum: Java Dec 9th, 2008 |
| Replies: 4 Views: 414 The lowercase part you have actually won't work for all cases...
What I would do is just have a boolean variable for each condition, and each check will set the appropriate variable to true or... |
Forum: C++ Dec 9th, 2008 |
| Replies: 5 Views: 442 Also try to keep your indentation a standard width - usually 3 or 4 spaces is good.
As for the non-standard includes as mentioned above, I'm guessing you are using something old like borland or... |
Forum: C++ Dec 9th, 2008 |
| Replies: 3 Views: 286 Not really sure what you are asking... but if you're asking what sum = sum + 5; does, then the answer is that it increases the value stored in sum by 5. |
Forum: C++ Dec 9th, 2008 |
| Replies: 2 Views: 331 The other option is to just sort both arrays which will make traversing the arrays and finding non-duplicates much easier. |
Forum: C++ Dec 9th, 2008 |
| Replies: 2 Views: 252 Well if the output is always zero, then either 5/9 is 0 or F-32 is 0. Try and write a small program that just prints the result of 5/9 and one that prints the results of F-32 after the user enters F.... |
Forum: Java Dec 9th, 2008 |
| Replies: 4 Views: 363 |
Forum: C++ Dec 8th, 2008 |
| Replies: 8 Views: 557 Not sure where to start on this one... You haven't really followed the instructions. The instructions state that EACH student data record should be dynamically allocated. Instead your student list... |
Forum: C++ Dec 8th, 2008 |
| Replies: 6 Views: 346 Have you learned about classes in your course yet? If so then you should be using them. If not, you should at least break your functions up into smaller, more manageable functions. Also you should... |
Forum: C++ Dec 8th, 2008 |
| Replies: 2 Views: 274 Hmm not exactly sure what that would be happening, but there are still a couple things you need to change. At the top you should declare gRow and gCol as const int - I'm not sure how this even... |
Forum: C++ Dec 8th, 2008 |
| Replies: 5 Views: 348 You are getting mixed up about what should be in your main() and what should be in your class methods.
As the problem specifies, input for a TMoney should be done in the inputdata() method, and... |
Forum: C++ Dec 8th, 2008 |
| Replies: 7 Views: 462 When adding the node at the end (as you are now doing), you should have the new node point to NULL instead of head. The reason you get it infinitely repeating is because when your end node points to... |
Forum: C++ Dec 8th, 2008 |
| Replies: 7 Views: 462 What exactly are the requirements? Are you supposed to be adding new nodes to the beginning of the list or the end of the list? Are you sure you are not supposed to get the result you got?
In the... |
Forum: C++ Dec 8th, 2008 |
| Replies: 7 Views: 462 Since you are adding nodes to the head (start) of the list, the last node you add will be in position 0. The output is correct for the example you gave. I'm assuming the list isn't supposed to be... |
Forum: Java Dec 7th, 2008 |
| Replies: 14 Views: 801 Did I say I don't know how to build a GUI from scratch? What is wrong with using a tool that makes the GUI design process quicker? |
Forum: Java Dec 7th, 2008 |
| Replies: 14 Views: 801 I usually use Eclipse, but switch over to Netbeans when I do any sort of GUI. |
Forum: Java Dec 5th, 2008 |
| Replies: 8 Views: 414 The Java API is your friend: http://java.sun.com/javase/6/docs/api/
Look up FileWriter, look at the constructor and the write methods. |
Forum: C++ Dec 5th, 2008 |
| Replies: 3 Views: 372 To add two times as you have listed, first add the seconds together. If the seconds > 59 you will have to use modulus (%) to find the remainder of the seconds. You can then use this information to... |
Forum: Java Dec 5th, 2008 |
| Replies: 16 Views: 1,024 You will need nested loops. The inner loop will print one line of numbers, while the outer loop controls how the pattern changes for the inner loop.
If you're still stuck, try solving the problem... |
Forum: Java Dec 4th, 2008 |
| Replies: 4 Views: 436 Just 71C15 alone is over 914 trillion combinations. A normal computer can do about 1 billion/sec. This means it will take about 10 days to compute just 71C15.
You might be able to do 71C7 or 71C8... |
Forum: Java Dec 3rd, 2008 |
| Replies: 4 Views: 494 Generally when you are doing recursion on any kind of collection of items (lists, arrays, even strings) you want to solve the problem for the first element of the collection, then recurse on the... |
Forum: Java Dec 2nd, 2008 |
| Replies: 2 Views: 417 I think you're going to need to give more information about what you need to do. |
Forum: C Dec 1st, 2008 |
| Replies: 3 Views: 586 You are right that the array name is the address of the first element of that array. This works exactly the same for arrays of char as well.
In C, there is no "string" type, so we are forced to... |
Forum: Java Dec 1st, 2008 |
| Replies: 3 Views: 516 Also try to reduce the amount of code you post. Just post the relevant parts. Add the exact error messages or example output to show us the problem. |
Forum: Java Dec 1st, 2008 |
| Replies: 4 Views: 345 What protocol do you want to simulate? At what layer? You should be able to code a simulation up depending on which protocol you want to simulate.
You might also want to do a search into network... |
Forum: C++ Dec 1st, 2008 |
| Replies: 5 Views: 388 You're off to a good start, here are some little tips/observations that might help you:
1/ Your header file should contain the structure definition as well as the function prototypes for functions... |
Forum: C++ Nov 30th, 2008 |
| Replies: 9 Views: 728 It depends on the platform. Since a pointer is an address, it must be big enough to store the largest address. I'm fairly sure that in windows addresses are 32bits (4 bytes). In linux/unix it may be... |
Forum: Java Nov 30th, 2008 |
| Replies: 4 Views: 600 Sorting by hand generally means the teacher wants you to show the array after each step of the sort from start to finish. |
Forum: Java Nov 30th, 2008 |
| Replies: 4 Views: 472 You shouldn't ever be returning the operators though, only the result of operations or the number value in the node.
In the first branch, after you apply the operator to the two children, you... |
Forum: Java Nov 28th, 2008 |
| Replies: 2 Views: 783 Since you want to return a string, just save the string returned from each recursive call, plus the string of the data in the node you are looking at and add them all together:
public void... |
Forum: C Nov 28th, 2008 |
| Replies: 2 Views: 413 You have allocated space for all of the studentInfo pointers here (except the last one, you should not be subtracting 1):
struct studentInfo *students[numOfStudents-1];
But, you have not... |
Forum: C Nov 20th, 2008 |
| Replies: 6 Views: 641 The above poster is not exactly correct.
When you call scanf(), if the function fails (which will happen when you try to read an integer but it is given a character), it will not actually consume... |
Forum: C++ Sep 3rd, 2008 |
| Replies: 11 Views: 1,930 Let's look at a simple example of how you might do this. Imagine you were give the number 72061.
The first thing you should do is determine how many digits there are - in this case 5. Now, you can... |