- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
64 Posted Topics
Re: I usually use Eclipse, but switch over to Netbeans when I do any sort of GUI. | |
Re: 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 simulation tools. I haven't used any, but I've heard of omnet and ns-2 … | |
Re: Just tested it with the changes mentioned, and it works for me too. | |
Re: 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 top n elements, only run the outer loop of selection sort n … | |
Re: If your SoapPair class has any member variables, all of them have to be of a type that is serializable. | |
Re: 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 list to see why.. - Your output module only outputs the currency type... are you sure that's … | |
Re: 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 creates a static sized array of 100 records. What you need to do is make a StudentRecord class which stores … | |
Re: 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 integer at the start of each message specifying the length of the … | |
Re: 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 ([I]this[/I]) as an argument to the panel constructor. You will need to change the panel constructor to accept this argument and store it. Now when … | |
Re: 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 unless the recursive version is much simpler to understand and implement. I'd say the biggest downside to recursion is … | |
Re: 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: [code] // First allocate for the first dimension board = new int*[height]; // Now allocate for the second dimension for( … | |
Re: 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 false. Then at the end just 'and' them all together to get whether it is … | |
Re: 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. | |
Re: 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 turbo C... I would recommend you start using either VC++ or Code::Blocks. | |
Re: The other option is to just sort both arrays which will make traversing the arrays and finding non-duplicates much easier. | |
Re: 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. That might help you narrow down the problem. | |
Re: 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 learn how and when to use header files and multiple cpp files rather than having … | |
Re: 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 output should be done in the outputdata() method. The main should only declare an … | |
Re: 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 compiles with no type given. Also you should make a loop … | |
Re: 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 sorted - if so then you need to change your add … | |
Re: The Java API is your friend: [url]http://java.sun.com/javase/6/docs/api/[/url] Look up FileWriter, look at the constructor and the write methods. | |
Re: 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 in steps. First create a loop that will print just one line of the pattern. … | |
Re: 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 figure out what the actual seconds are and that a minute … | |
Re: 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 related to that structure. So basically you should move the function prototypes into your header. Remove the last … | |
Re: 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 in a reasonable amount of time. | |
Re: 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 remaining part of the collection. For this example you can look at the first element of … | |
Re: I think you're going to need to give more information about what you need to do. | |
Re: 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 different. | |
Re: 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 use arrays of char. There is one special difference between … | |
Re: 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. | |
Re: 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 should get back a double then return that. In the second branch you should be returning … | |
Re: Sorting by hand generally means the teacher wants you to show the array after each step of the sort from start to finish. | |
Re: 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: [code] public void inorder() { if(leftChild != null ) String s1 = leftChild.inorder(); String s2 = … | |
Re: You have allocated space for all of the studentInfo pointers here (except the last one, you should not be subtracting 1): [code]struct studentInfo *students[numOfStudents-1];[/code] But, you have not allocated space for the actual studentInfo structures that each pointer will point to. To do that you will have to make a … | |
Re: 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 the input character from the input. This means the next time you call scanf() … | |
Re: 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 divide by 10^4 (10 to the power 4, 4 because … | |
Re: The reason people are discouraging you is because the very basics of this topic might be material for a senior undergrad course or a graduate course, and considering you said you were a semi-beginner programmer, you probably aren't quite ready for something of this magnitude. Before even starting to code … | |
Re: It should be [code]readfile >> sample;[/code] since you are getting input, not outputting. | |
Re: [QUOTE]I want to write a javascript[/QUOTE] Then why are you posting this in the C++ forum? | |
Re: The line [code]if (argv[1] == "/e")[/code] is invalid since you are compairing a char pointer to a string. To compare strings, use strcmp(). Also, if the user doesn't enter the easteregg argument, you don't want to check argv[1], so first check argc to check the number of arguments. | |
Re: I just learned some MPI recently and I have a PDF with some basics about how to use it with C (and possibly fortran, i forget). Just PM me your email address and I'll send it over. | |
Re: There is no real point in writing a "bug-fix class". Essentially the derived class will have to overload all the methods of the base class anyway - so none of the parts of the base class will be used. Either make a new class with the functionality you want, or … | |
Re: You can use the built in STL sort algorithm - [url]http://www.cplusplus.com/reference/algorithm/sort.html[/url] Just follow the example at the bottom where they overload the lessthan operator for the class. | |
Re: I have not used them, but I believe the boost library has threads and you can try pthreads as well. | |
Re: I can guarantee you the problem is not winsock, it is something you are doing. Can you post a little code where you are having the problem, tell us what you are trying to send and what you are receiving? | |
Re: First of all, if you want 30 strings of up to 20 characters each, then your declaration should be the other way around, and you need an extra char for each null terminator (the character that ends a string): [code=c++] char axx0[30][21]; // 30 strings of up to 20 character … | |
Re: Vertices are the points or corners of a polygon. So a square is a polygon with 4 vertices, a triangle is a polygon with 3 vertices, etc. | |
Re: A lot of important questions here, so I will try and answer them the best I can. First, the main difference between passing by value and passing by reference.. When we pass by value, the receiving function obtains a copy of the variable. If the function then alters the contents … | |
Re: As someone asking a question, I would much rather prefer answers to be short, few, and useful, rather than have everyone post answers and having to sort out which one is correct. In some things there can be debate (style issues and such), but on correctness there is no room … |
The End.