389 Posted Topics

Member Avatar for gizmo7008

You're asking the player for his choice (by calling `humanChoice`) twice: Once in `main` and once in `printScore`. PS: On line 24 you will always break because the condition `choice == 'Q' || 'q'` is always true (because 'q' is true).

Member Avatar for gizmo7008
0
901
Member Avatar for HTMLperson5

Your else branch is missing a closing }. As a tip for the future: Many browsers have some sort of Javascript console, which lists any errors that were encountered while trying to execute the Javascript on the current page. Looking at the messages in that console will help you find …

Member Avatar for lambing
0
164
Member Avatar for rotten69

I think you want `if( getVal.indexOf("pepsi") != -1)`. Note that this also returns true if the given string looks like "FOO,BARpepsiBLA,BAZ". If you want to avoid that you can either split the string or use arrays instead of strings in the first place. PS: There's no need for loop labels …

Member Avatar for AleMonteiro
0
99
Member Avatar for newtohacking1337

There is no string literal (T_STRING) on line 11 in the file you posted. Are you sure the file you posted is the one the error messsage is complaining about?

Member Avatar for sepp2k
0
443
Member Avatar for sharath_137
Member Avatar for sharath_137
0
92
Member Avatar for iamnot

I think you might get more help if you described your recursive algorithm instead of requiring us to discern it from your uncommented code. Anyway I think the standard dynamic programming solution for the coin change problem can be adjusted to work for this variation of the problem.

Member Avatar for sepp2k
0
137
Member Avatar for rotten69

When you create the array it does only have 3 elements in it. That doesn't mean you can't add more to it.

Member Avatar for sepp2k
0
222
Member Avatar for TheBusDriver

> Is there any way to make A work without using new (that includes placement new)? No, non-POD classes can not be allocated dynamically without using `new`. As far as the standard is concerned, it's undefined behavior to not use `new`. In practice the problem is, as you suspected, the …

Member Avatar for sepp2k
0
657
Member Avatar for sebass123

One mistake I immediately saw (though it's probably not the only one and might not be what's causing your crash) is that you're returning `x[i][j]` on line 91, but `i` and `j` are equal to Max and MAX (horrible names by the way) after the loop, so that's an out …

Member Avatar for Perry31
0
124
Member Avatar for MasterHacker110

Have you tried to run your code in the debugger to find out which line the segmentation fault happens on? Have you tried to run your code through valgrind to find out when and where you write to or read from invalid memory? Also can you give us some sample …

Member Avatar for MasterHacker110
0
2K
Member Avatar for sebass123

The error on line 21 is that you forgot the () to call the function. So you're trying to assign a function to a double variable. The error on line 105 is that the argument to scanf needs to be a pointer, not a double. Also you're using openfilewrite uninitialized, …

Member Avatar for sebass123
0
118
Member Avatar for deshazer.jad

If your method calls a method that can throw an IOException (like `ImageIO.read` does), you either need to catch the exception or declare that your method may throw an IOException too (which you do by adding `throws IOException` to your method's signature). You have to do this because IOException is …

Member Avatar for deshazer.jad
0
852
Member Avatar for mrgadgets

> Do we need to pay fee to Oracle if we sell our game on the market or host it on our own web site with advertisement on the game page? No. > Also can we sell software written in Java? Yes.

Member Avatar for stultuske
0
246
Member Avatar for Valiantangel

When you call a method, you don't spell out the type of the arguments - you only do that when declaring the method. I.e. if you want to call `drawHexagon` with `width` as its argument, you write `drawHexagon(width)` not `drawHexagon(int width)`. That said, unless the SimpleTurtle class has a static …

Member Avatar for corby
0
135
Member Avatar for G.CK

> Can the two features of C++ Function overloading and function templates be applied together ?? Yes. You can define multiple functions with the same name even if one or all of the overloads are template functions. When you do this, the non-templated overloads will be considered first and if …

Member Avatar for G.CK
0
327
Member Avatar for viktor.baert

There's nothing in your code that would reset the value of plus. However with your constructors the way they are, there is no way to create a tuna object that has the numbers as well `plus` set to a meaningful value. So I'm guessing when you use your code, you're …

Member Avatar for viktor.baert
0
939
Member Avatar for trishtren

There is nothing you can do to make `newtype f = 1` work. Java doesn't allow implicit conversions for non-primitive types. There's also no way to make arithmetic operators like + etc. work with your newtype class. Using a user-defined number class will always look different than using primitive numbers …

Member Avatar for sepp2k
0
134
Member Avatar for vasvigupt

Your code is wrong. It has a couple of syntax errors and you're accessing your array out of bounds. The last valid index for an array of size n is n-1, so your for-loops should use <, not <=. Also the inner for-loop doesn't ensure that $j is a valid …

Member Avatar for Que336
0
277
Member Avatar for MasterHacker110

There are many GUI libraries for Linux/X11. The most popular ones are GTK (the one that Gnome and XFCE use (among others)) and Qt (the one that KDE uses). Both of them run on all major platforms, not just X11.

Member Avatar for L7Sqr
0
208
Member Avatar for Skrell

Your types are wrong. Your compiler should have warned you about that. If it didn't, increase your warnings level - that will save you a lot of pain in the future. arrayptr and rowptr should have types `char*` and `char**` respectively. Since you made arrayptr and int-pointer, your second for …

Member Avatar for Skrell
0
101
Member Avatar for MGibson019

I can't reproduce the behavior you're describing. Your code doesn't produce the output you say it does - your code doesn't even compile. If I correct the code's syntax error, the result will always be the empty list because you have overlapping cases with the less specific case coming first. …

Member Avatar for MGibson019
0
347
Member Avatar for rahul.ch

a) In Java we usually speak of "object references", not "memory addresses". Memory addresses are a low-level concept that isn't really visible to Java programmers. But yes, when you pass m2 to the Mixer constructor, you're passing a reference to the object that m2 refers to. So the m1 variable …

Member Avatar for sepp2k
0
262
Member Avatar for HankReardon

`secondString = number_list[1:2]` will give you a list that contains the second string as its only element. Then when you do `secondString[0:2]` you're saying "take the first two elements of this list", but the list only has one element, so you get the same list back unchanged. What you want …

Member Avatar for HankReardon
0
232
Member Avatar for BHKK

One obvious problem I can see is that you call `malloc(sizeof(treepointer))` to allocate memory for a node of the tree, but that will only allocate enough memory to store a pointer. You need to allocate enough memory to store an entire node, so you need to use `sizeof(nodo)` as the …

Member Avatar for BHKK
0
603
Member Avatar for rockerjhr

You need it because you don't know whether x_1 is greater or less than x_0. If x_1 is less than x_0, then `x_1 - x_0` will be negative and thus less than pres even if x_1 and x_0 are far apart.

Member Avatar for mike_2000_17
0
1K
Member Avatar for cossay

Your copy constructor calls your setFoo methods. Your setFoo methods use delete on the old value of the variable that they're setting. When the copy constructor is invoked, the variables won't have old values because the object is brand new. That means that your setFoo methods will call delete on …

Member Avatar for cossay
0
238
Member Avatar for Djmann1013

You're getting the parse error because you forgot a semicolon on line 2. Whenever you get "Unexpected blabla" at the beginning of a line, there's a good chance that you forgot a semicolon on the line before.

Member Avatar for sepp2k
0
227
Member Avatar for HTMLperson5

You have a plus sign on either side of choice. But on the left side there's no left operand for addition. So the left plus is interpreted as the unary plus operator (which is the opposite of the unary minus (negation) and basically does nothing on numeric operands). Like most …

Member Avatar for sepp2k
0
1K
Member Avatar for somjit{}

> when break() occurs, i assumed that it would be a clean break() It is. > but clearly it isnt turning out so, and acc[i] is catching a junk value. When break occurs it leaves the loop just as it should. But acc[i] simply isn't initialized. Let's play it through …

Member Avatar for somjit{}
0
175
Member Avatar for Synestic

You can use the `str_replace` function to replace each occurence of "." in `$description` with `".\n"`, i.e. to insert a newline (\n) after each period. If you want to display your string as HTML, you should use "<br>" instead of (or in addition to) "\n".

Member Avatar for Dani
1
165
Member Avatar for capton

QRC files are XML files, so comments can be written using the XML comment syntax: <!-- This is a comment! -->

Member Avatar for sepp2k
0
66
Member Avatar for HTMLperson5

Your Javascript shows a bit of a Python influence. In Javascript you use curly braces to denote the beginning and end of a function body - not indentation. And there's no colon after the function signature.

Member Avatar for JorgeM
0
219
Member Avatar for tpowell0201

You're missing a semicolon at the end of line 40, so the parser is confused when it sees the variable at the beginning of line 41.

Member Avatar for akmozo
0
156
Member Avatar for hszforu

The problem is unrelated to the fact that test takes a variable number of arguments. The problem is that you're calling `test` as if it was a method of the `VariableArguments1Test` class, which it's not. If you want to call a static method of another class, you'll need to specify …

Member Avatar for hszforu
0
133
Member Avatar for massivefermion

csc.exe is the C# compiler that comes with Microsoft's .net SDK. mcs is the C# compiler that comes with Mono. Neither of these ship with MonoDevelop, but you need to have one of them installed in order to use MonoDevelop. So if you want to find csc.exe, you should look …

Member Avatar for massivefermion
0
153
Member Avatar for thiemebr

Image.FromStream throws an ArgumentException if you call it with null as an argument or if the given stream does not contain an image in a valid (and supported) format. Since you set streamImage on the line above, it is probably safe to assume that it is not null. So the …

Member Avatar for thiemebr
0
491
Member Avatar for king03

Also you create a new Random object each time you call RandomNumber. This won't cause a compilation error or anything, but it will cause RandomNumber to return the same number repeatedly when invoked multiple times in a short period of time (e.g. in a loop). You should create a new …

Member Avatar for ChrisHunter
0
269
Member Avatar for newbie1234

> How to implement sizeof api. Means sizeof is already there but i do not want to use that. You can get the size of a given type T by doing by adding 1 to a T null pointer and then converting the result to a size_t. You can get …

Member Avatar for sepp2k
0
129
Member Avatar for poloblue

Your code doesn't seem to match your description at all. You said the function should return a Rectangle, but the function in the code actually takes a rectangle (that it never uses) and returns an int. Your function also calculates the area of the rectangle that the user entered which …

Member Avatar for poloblue
0
202

The End.