1,857 Posted Topics

Member Avatar for Matias_2

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 …

Member Avatar for Reverend Jim
0
430
Member Avatar for Dietrich_1
Re: GCD

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 …

Member Avatar for tinstaafl
0
186
Member Avatar for Dietrich_1

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. …

Member Avatar for JamesCherrill
0
452
Member Avatar for Dietrich_1

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

Member Avatar for JamesCherrill
1
361
Member Avatar for Eoin_1

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

Member Avatar for Reverend Jim
0
340
Member Avatar for Zxander

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 < …

Member Avatar for Zxander
0
360
Member Avatar for divinity02

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 …

Member Avatar for tinstaafl
0
286
Member Avatar for Dietrich_1

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; …

Member Avatar for tinstaafl
0
423
Member Avatar for Prathamesh_1
Member Avatar for kay_1

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` …

Member Avatar for jkon
0
450
Member Avatar for nadiam

`print` throws an exception because there is no `print` method. There is however a `println` method.

Member Avatar for JamesCherrill
0
522
Member Avatar for mldardy

Are you trying to read an xml file and display it? Or, take some data and create an xml file representing that data?

Member Avatar for mldardy
0
7K
Member Avatar for Mario_6

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 …

Member Avatar for tinstaafl
0
6K
Member Avatar for karthikprs

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 …

Member Avatar for geniusvishal
0
222
Member Avatar for Sai Nave

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 …

Member Avatar for tinstaafl
0
461
Member Avatar for musa B

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 …

Member Avatar for Reverend Jim
0
414
Member Avatar for vin_1
Member Avatar for Meghan_1

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.

Member Avatar for JamesCherrill
0
767
Member Avatar for KushMishra

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 …

Member Avatar for KushMishra
0
4K
Member Avatar for Reginald Xavier

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.

Member Avatar for tinstaafl
0
292
Member Avatar for Reginald Xavier

@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 …

Member Avatar for Reginald Xavier
0
447
Member Avatar for Alexandre_2

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 …

Member Avatar for Reverend Jim
1
549
Member Avatar for SkateX

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 …

Member Avatar for SkateX
0
356
Member Avatar for JohnMcPherson
Member Avatar for JohnMcPherson
0
636
Member Avatar for _1_14

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.

Member Avatar for tinstaafl
0
2K
Member Avatar for Miguel_7

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.

Member Avatar for tinstaafl
0
158
Member Avatar for murali89

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

Member Avatar for murali89
0
384
Member Avatar for _1_14

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.

Member Avatar for tinstaafl
0
740
Member Avatar for Noname_2

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.

Member Avatar for tinstaafl
0
507
Member Avatar for Josh_3

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); }

Member Avatar for tinstaafl
0
449
Member Avatar for Jim_11

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 …

Member Avatar for tinstaafl
0
581
Member Avatar for Joe_29

basically open the ofstream object for output, then use it instead of cout(`outFS<<inputFilename;`).

Member Avatar for rproffitt
0
303
Member Avatar for major_lost

@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.

Member Avatar for Reverend Jim
0
4K
Member Avatar for Amall_1

You have my permission go ahead. One place to start is [here](https://www.daniweb.com/welcome/rules).

Member Avatar for tinstaafl
0
91
Member Avatar for lolici
Member Avatar for thines01
0
398
Member Avatar for Karuna_2

One way is to use the [Application Settings Feature](https://msdn.microsoft.com/en-us/library/k4s6c3a0(v=vs.110).aspx) of .net.

Member Avatar for tinstaafl
0
288
Member Avatar for gugushe

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).

Member Avatar for tinstaafl
0
1K
Member Avatar for EF_1

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`

Member Avatar for tinstaafl
0
172
Member Avatar for Andrew_39

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 …

Member Avatar for Johan_1
0
7K
Member Avatar for Rodrigo_5

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 …

Member Avatar for tinstaafl
0
319
Member Avatar for Dick_2

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 …

Member Avatar for Dick_2
0
2K
Member Avatar for yuriy_1

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.

Member Avatar for tinstaafl
0
365
Member Avatar for yuriy_1

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 << …

Member Avatar for tinstaafl
0
530
Member Avatar for tnd2491

You could try adding a list of member groups to the profile. If the profile exists just add the group to the list.

Member Avatar for tinstaafl
0
323
Member Avatar for Brittany_2

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 …

Member Avatar for Nutster
0
1K
Member Avatar for Minimalist
Member Avatar for Karuna_2

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 …

Member Avatar for tinstaafl
0
455
Member Avatar for can-mohan

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.

Member Avatar for tinstaafl
0
247
Member Avatar for Dani

I'm wondering if combining a tech oriented news/discussion portal with Q&A forums would fit the bill?

Member Avatar for Reverend Jim
0
731
Member Avatar for Karl_6

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 …

Member Avatar for tinstaafl
0
578

The End.