1,857 Posted Topics
Re: It looks to me you already failed the critical part of the exercise: > Remember that good correct functions are required too, you must pass the 2d array to a function!! You should start with this. Read the data into the array and pass it to a function and process … | |
Re: Not sure what this loop: while(small !=0) { int remainder = larger % small ; larger = small ; small = larger ; } is supposed to do, but `larger` and `small` never change, therefore `small` will never get to 0. All you're doing is swapping the values over and … | |
Re: I noticed a few things with your code: you're using 2 variables,`index` and `pos` when 1 will do, just give it the new value from `indexOf` you're using a `for` loop and changing it's counter. This is bad form and can lead to hard to find bugs in your code. … | |
Re: An explanation of what your code is supposed to do and what it is doing wrong is essential to getting someone to help you. Remember to include sample inputs, their results, and what you expect | |
Re: One thing that could help. Check the Security tab in the file Properties and make sure you have permission. Then check each folder in the path back to the root folder | |
Re: The simplest way,most likely, would be to wrap that while loop in another while loop that's based on whether the user wants to play again. Something like this should work: public static void main(String[] args) { Hangman hangman = new Hangman(); boolean quit = false; while(!quit) { while (hangman.count < … | |
Re: One thing that caught my eye, is line 64. You're calling `doublearea` but you're not assigning the return value to anything, or trying to display it anywhere. Assigning the return value to `area` should work: @Override public void actionPerformed(ActionEvent ae) { double A = Double.parseDouble(side1.getText()); double B = Double.parseDouble(side2.getText()); double … | |
Re: Here: Student student1 = new Student() ; The program is trying to call the default constructor, but the `Student` class doesn't have one, which, if I'm not mistaken, became required as soon as you added the other constructors. Try adding this: public Student() { name = ""; test1 = 0; … | |
Re: Another fine example of spaghetti code. | |
Re: Just from a qucik perusal of your code, it looks to me that instead of iterating through the array by using `i` as the index, you've hard coded the index as `10`, the eleventh element in the array, which is beyond the bounds of the array. Try replacing the `10` … | |
Re: `print` throws an exception because there is no `print` method. There is however a `println` method. | |
Re: Are you trying to read an xml file and display it? Or, take some data and create an xml file representing that data? | |
Re: Your problem appears to be that your are using `scoretotal` to accumulate the total, but you are re-adding each previous score everytime you add a score. The simplest fix would be to eliminate the loop and just add `score` to `scoretotal` each time you add it to the list: private … | |
Re: As for storing your data a 2D dictionary would work: Dictionary<string,Dictionary<string,FileInfo[]>> fileTree; The outer dictionary would have the year as the key. Each year then would contain a dictionary with the month as the key. Each month would then have an array of FileInfo objects referring to the files for … | |
Re: Here's the code the way it's supposed to look. When you paste it in, remember to highlight it all and hit `Tab` once. When all the code is green it will stay formatted properly. public partial class Form1 : Form { double w; double z; Thread T; int flag; delegate … | |
Re: Another interesting topic, that's apropos for today, is AI Ethics. How far do we go in incorporating the 3 Laws of Robotics, that Asimov codified. Do we make exceptions for military, medical, security,policing,etc.? As AI becomes more advanced, how much autonomy do we give them? At what point can they … | |
Re: It appears to me that you need 2 sets of calls 1 to the Publication setters and one to the Book setters. The error is because you can't assign the result of a void return to a variable. | |
Re: According to your description it looks to me that your collection will contain objects that may have more than one name associated with each specific id. If this is the case then something along these lines might be closer to what you're looking for: Dim dict = (From a In … | |
Re: To actually pass the data, using a constructor for form2 that accepts the data and populates the form with it, is probably the simplest way. | |
Re: @rproffitt - Actually the `Handles`clause in VB.net looks after that. @Reginald Xavier - It looks to me that after checking for the empty/incorrect string, you're exiting the sub routine and the recalculation never happens. One way around this is to reset the text to a base amount, probably 0, instead … | |
Re: It seems to me you're putting the cart before the horse. Any programming for your OS is going to depend on the Application Programming Interface(API). This allows your OS internal functions to stay hidden and you can control what the programmer is allowed to do. To design the programming language … | |
Re: Some things I noticed: * Instead of trying to create 2 format strings, reuse the one you used for the header, this way you can get things to line up consistently. * In line with that, `HEADER` isn't really a good name for that string. How about `LINE_FORMAT`? * Use … | |
Re: Have you tried declaring the structure in a header and including it where needed? | |
Re: This [post](https://social.msdn.microsoft.com/Forums/vstudio/en-US/431371d0-73a5-4d89-a335-0890c3f87135/print-image-in-c?forum=csharpgeneral), shows an answer with some very simple code. | |
Re: You say you want to learn C, but your code mixes C and C++, and yes they are similar but different languages. I would suggest, instead of trying to take a shortcut, find a comprehensive tutorial site and actually study and learn the language that you want to learn. | |
Re: I suspect your problem has to do with whitespaces. Try enclosing the path in quotes("): javac -classpath "C:/Program Files (x86)/Apache Software Foundation/Tomcat 7.0/lib/servlet-api.jar":classes:. -d classes src/com/example/web/BeerSelect.java | |
Re: I think youre first step should be to investigate other similar librairies. Just a quick glance at that one makes me question whether it's the most efficient. | |
Re: Basically `as` is a noexception way of casting one object to another type. This [article](https://docs.microsoft.com/en-us/dotnet/articles/csharp/programming-guide/types/how-to-safely-cast-by-using-as-and-is-operators) has a pretty good explanation. | |
Re: Your code could definitely use some refactoring. However for your immediate problem, try skipping the space with `ignore()`: while (inFile) { inFile >> tid; inFile.ignore(); inFile.getline(comment, 30); int index = getTitleIndex(list, tid, num); //cout << index << endl; list[index].addcomment(comment); } | |
Re: Another way to approach this is to use the DataTable Compute method. Here's some simple code using the Northwinds database. first we created the datable with the columns we need: Type typeInt = Type.GetType("System.Int32"); Type typeString = Type.GetType("System.String"); Type typeDecimal = Type.GetType("System.Decimal"); ds.Tables.Add("Order"); ds.Tables["Order"].Columns.AddRange (new DataColumn[] { new DataColumn("ProductName",typeString), new … | |
Re: basically open the ofstream object for output, then use it instead of cout(`outFS<<inputFilename;`). | |
Re: @doncwilson_1 this is a solved question, you're supposed to start you're own, rather than piggyback someone elses. As far as I know it's ok to referencxe this question in a link if you need to. | |
Re: You have my permission go ahead. One place to start is [here](https://www.daniweb.com/welcome/rules). | |
Re: What errors if any are you getting? What line(s) is(are) the error(s) pointing to? | |
Re: One way is to use the [Application Settings Feature](https://msdn.microsoft.com/en-us/library/k4s6c3a0(v=vs.110).aspx) of .net. | |
Re: Also remember that when you change the declaration of the class, you also have to change every where that name is used, like in the constructor and destructor(the prototype and the actual methods). | |
Re: C# also has a [Conditional ternary operator(?:)](https://msdn.microsoft.com/en-us/library/ty67wk28.aspx), which will function the same as the IF function: `B4<NOW() ? T4 : 0` | |
Re: Since there seems top be some confusion on your part, I would suggest a bit of refactoring. By making Month a nested class with members, name and days, You can simplify several parts of your code by storing the different months and their respective days in an array. It's a … | |
Re: The first that jumps out at me, is you're not setting a value to `minval`, which means that it'll get assigned the default value of 0. Therefore none of the numbers chosen will be less than that. Giving it the maximum allowed value, will ensure that whatever is chosen will … | |
Re: Instead of trying to balance concurrent arrays, use a custom type(RepairType) to represent each line. This way a `vector<RepairType>` will give you access to everything you need. Reading the values into the vector becomes fairly simple then: struct RepairList { class RepairType { public: int code = 0; string part … | |
Re: You need to exercise some patience, and not keep asking the same question over and over again. And try to tag the post properly with the language you're using. | |
Re: You're reading the first line using `getline`, then the subsequent reads are on the next line. Get rid of that and build the full name inside the `while` loop: if (names_.is_open()) { while (names_ >> firstName >> middleName >> lastName) { cout << lastName << ", " << firstName << … | |
Re: You could try adding a list of member groups to the profile. If the profile exists just add the group to the list. | |
Re: This is a very good argument for using meaningful names for your variables instead of just letters. You set `x` to the number of games, but at the bottom of the while loop you indicate it should be the number of guesses. The first thing I would suggest is to … | |
Re: Also, show the code for loading the dgv. | |
Re: Your problem is you're not paying attention to what the New constructor for StreamWriter wants and what GetfolderPath is supplying. The constructors that accept a string, only accept one string, the full path of the file to open. GetFolderPath only supplies the path of the directory you specify, which, in … | |
Re: Also depending on how much you're changing the size, it would be possible to have a smaller file size and still use the same amount on the hard drive, due to the way your OS has structured the file system. | |
Re: I'm wondering if combining a tech oriented news/discussion portal with Q&A forums would fit the bill? | |
Re: I would suggest that instead of going through the expense of an extra conversion, just keep `gradePointAverage` as a double. This will also be more accurate, since, with your code, a GPA of 2.1 will fail, because it will be converted to 2. The conditional will stll work, but you … |
The End.