Forum: C++ 30 Days Ago |
| Replies: 10 Views: 845 |
Forum: C++ Jun 7th, 2008 |
| Replies: 4 Views: 241 Re: Continue statement and alternatives No. "continue" skips the remaining iteration of the loop (in this case, the for loop). So it goes directly to the "n++" step, and then starts the next iteration of the loop, testing the condition and... |
Forum: C++ Jun 7th, 2008 |
| Replies: 14 Views: 495 Re: Vector and virtual function questions why not just call
pedal()
what is the difference?
if pedal is a virtual function in "cycle", then both will accomplish the same thing
this is identical to just
pedal() |
Forum: Java Jun 7th, 2008 |
| Replies: 1 Views: 201 |
Forum: C++ Jun 6th, 2008 |
| Replies: 7 Views: 347 Re: Memory Allocation Understanding, new []() No. The vector takes care of deallocating any memory it uses when it is destructed, which also destructs all the things in the vector. The string takes care of deallocating any memory it uses when it... |
Forum: Java Jun 3rd, 2008 |
| Replies: 3 Views: 191 Re: When would one ever use the Method class? Reflection. you need it when you want to invoke a method by reflection. A method does not have to be public to be invoked. However, you will need to know how to get it. (Class.getMethod() will not... |
Forum: C++ May 31st, 2008 |
| Replies: 2 Views: 168 Re: Frustrated with Arrays of Objects The standard way to do it with inheritance is probably to have an array of Employee pointers
Employee* employees[10];
(You can also dynamically allocate it if you really wish. It will be... |
Forum: C++ May 29th, 2008 |
| Replies: 14 Views: 442 |
Forum: C++ May 29th, 2008 |
| Replies: 9 Views: 600 |
Forum: C++ May 29th, 2008 |
| Replies: 7 Views: 432 Re: Confused about use * in declaring char arrays These are identical. It is a pointer in both cases. So I guess it may be more clear to write it as a pointer. The second case might cause beginners to think that you are passing an entire array by... |
Forum: Python May 28th, 2008 |
| Replies: 3 Views: 1,023 |
Forum: C++ May 24th, 2008 |
| Replies: 5 Views: 214 Re: STL map? This is wrong, by the way. "m[i]" looks up "i" as a key in the map. So it will not only fail to compile when "T" is not "int"; but even when it is an int, the binding might not exist. |
Forum: Java May 18th, 2008 |
| Replies: 11 Views: 811 Re: "Pointers" in Java Yes, they are called "reference types". The references point to objects.
.
You mean that you cannot have objects as values, then yes.
Yes, they are called primitive types.
Basically. There is no... |
Forum: C++ May 15th, 2008 |
| Replies: 1 Views: 133 Re: Error with sorting? it's right. vector doesn't have a method named "length()". it does have a method named "size()". |
Forum: C++ May 15th, 2008 |
| Replies: 2 Views: 154 Re: Using New this one only works if the "3" part is a constant, and always creates a "rectangular" array made of contiguous parts, no pointers involved |
Forum: C++ May 14th, 2008 |
| Replies: 9 Views: 363 Re: using a vector::iterator Next time, at least put in minimal effort and post an error or something; instead of other people repeatedly posting suggestions, and you just saying "doesn't work" each time without any clue as to... |
Forum: Network Security May 13th, 2008 |
| Replies: 112 Views: 120,941 |
Forum: C++ May 12th, 2008 |
| Replies: 3 Views: 169 |
Forum: C++ May 11th, 2008 |
| Replies: 7 Views: 309 Re: Expandable Array Problems Also, a fundamental problem with your grow() function:
The last line is completely useless, because "array" is a local variable, assigning it has no effect outside the function. |
Forum: C++ May 9th, 2008 |
| Replies: 2 Views: 356 Re: recursive binary search tree So these are all very self-explanatory. What part of the errors don't you understand?
Apparently Find() takes two arguments (a bool reference as a second argument) and doesn't return anything;... |
Forum: C++ May 6th, 2008 |
| Replies: 3 Views: 233 Re: confused by const the second and fourth const are utterly and completely pointless. there is never a point to declare that a value passed by value is not going to be modified. you should remove them |
Forum: C++ May 3rd, 2008 |
| Replies: 5 Views: 1,256 Re: C++ static class static local variables and static data members have lifetimes like global variables (there is only one copy in the program, and it exists for the whole duration of the program), except that their... |
Forum: C++ May 3rd, 2008 |
| Replies: 4 Views: 216 Re: conversion from binnary to octal sum should be set to 0 at the beginning of every iteration of the outer loop
and i is only incremented at every block of three, so "bin[i]" is the same all three times |
Forum: C++ May 2nd, 2008 |
| Replies: 7 Views: 209 |
Forum: C++ May 2nd, 2008 |
| Replies: 4 Views: 187 |
Forum: C++ May 2nd, 2008 |
| Replies: 3 Views: 170 |
Forum: Java May 2nd, 2008 |
| Replies: 4 Views: 494 |
Forum: C++ May 1st, 2008 |
| Replies: 5 Views: 246 |
Forum: C++ Apr 29th, 2008 |
| Replies: 2 Views: 148 |
Forum: C++ Apr 29th, 2008 |
| Replies: 4 Views: 434 Re: Erasing Elements in a Vector if you need to delete arbitrary elements a lot, then perhaps you don't want to use a vector, because it is very expensive, both to find it and to shift all the remaining elements |
Forum: C++ Apr 28th, 2008 |
| Replies: 3 Views: 248 |
Forum: C++ Apr 26th, 2008 |
| Replies: 3 Views: 240 |
Forum: Java Apr 26th, 2008 |
| Replies: 7 Views: 424 Re: Reversing a number you could either get all the digits out into a list or something, and then parse them back into a number in reverse
or just take the input as a string and reverse the string |
Forum: Java Apr 25th, 2008 |
| Replies: 2 Views: 308 |
Forum: C++ Apr 24th, 2008 |
| Replies: 6 Views: 501 |
Forum: C++ Apr 24th, 2008 |
| Replies: 14 Views: 1,176 Re: hcf and lcm note that with any two numbers a and b, a * b = gcd(a, b) * lcm(a, b) |
Forum: C++ Apr 24th, 2008 |
| Replies: 5 Views: 240 |
Forum: Java Apr 23rd, 2008 |
| Replies: 17 Views: 523 |
Forum: C++ Apr 22nd, 2008 |
| Replies: 2 Views: 367 Re: C++ class as function pointer no, it is better that you make the class a functor class (its has an overloaded function call operator); and then you should template the sort function, so it can either take a function pointer or a... |