Forum: Java Sep 2nd, 2009 |
| Replies: 3 Views: 365 Check this page:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html |
Forum: C++ Sep 1st, 2009 |
| Replies: 9 Views: 400 If you are using UNIX, you can use valgrind to check for memory leaks. You need to add --tool=memcheck on the command line to check for leaks. |
Forum: C++ Aug 30th, 2009 |
| Replies: 11 Views: 597 Looks good, but there is a piece of code I would like to show you:
if(is_door_opened==true)
You can simplify this conditionnal expression with:
if (IsDoorOpened())
and make this method... |
Forum: C++ Aug 30th, 2009 |
| Replies: 5 Views: 421 I did a mistake in my last post: the >> operator reads data until a end-of-line character OR a whitespace is found. |
Forum: C++ Aug 30th, 2009 |
| Replies: 5 Views: 421 Are you sure that the file denoted with the name you provided exists?
I'm pretty sure that the answer is yes, but do you really have gSize vertices in your file? Do you really have a line at each... |
Forum: Perl Apr 5th, 2009 |
| Replies: 4 Views: 655 You can do this:
no warnings ;
no warnings 'all' ; |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 Have you created a new project or have you just opened the file? Opening the file only prevents you from building the executable. You must create a project. |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 See this address for the express edition, I recommend it instead of VC++ 6.0:
http://www.microsoft.com/Express/ |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 Maybe you have a specific setting, a flag or something. Check this page:
http://social.microsoft.com/Forums/en-US/vcgeneral/thread/d2677732-d756-42e5-b2f1-5b040819c037
Don't forget that a... |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 Do you have a 64-bit machine?
Have you tried to restart Visual Studio and build again your solution?
Also, I know that a "Clean Solution / Rebuild Solution" solves a lot of problems.
You can... |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 382 Don't forget to make the thread as solved. |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 382 According to cplusplus.com (http://www.cplusplus.com/reference/string/string/append.html) ...
string& append ( size_t n, char c );
Appends a string formed by the repetition n times of... |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 382 About my last post, I have realized that operator[] returns a const char& and not a const char* that will have be used to construct a string.
Instead of using peek, you can use conditions, like... |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 382 Ok, first, it is very ugly to do:
string(change.begin() +i,change.begin() +i+1)
Instead, do this:
change[i] |
Forum: Java Mar 25th, 2009 |
| Replies: 4 Views: 350 You can still use a refactoring tip: Introduce Explaining Variable.
Declare, for each equals(), a bool that contains the result of this operation and use them in the if statement instead of the... |
Forum: Java Mar 25th, 2009 |
| Replies: 9 Views: 405 First, you should access the static methods (add, minus) in a static way, like Money.add( ... ) and Money.minus ( ... ).
Accessing a static method on an object (ok) is not supposed to change the... |
Forum: Java Mar 3rd, 2009 |
| Replies: 10 Views: 2,508 Use System.out.println("Your message") to print debugging messages about your input string and the value of every variable. First, ensure that the string is received from the scanner. After, look in... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 18 Views: 710 You should put the numbers at some place... and check every one of them...
That is an extremely easy solution. |
Forum: Java Feb 23rd, 2009 |
| Replies: 6 Views: 705 On which OS are you using?. It may not do a difference, but the "slash-backslash" complexity can cause this.
Otherwise, look at the renameTo method. Look for special permissions or existence of... |
Forum: Java Feb 23rd, 2009 |
| Replies: 5 Views: 1,283 This amount of code is impossible to read!
Test your stack before attempting to use it! |
Forum: Java Feb 23rd, 2009 |
| Replies: 6 Views: 705 If the file you want to copy is already used by an another process (if this is it), you cannot have access to it (except if you have special permissions).
This is very useful program for spotting... |
Forum: Java Feb 23rd, 2009 |
| Replies: 3 Views: 224 This is what I suggest to you:
1) You will take your FileToArray() function and you will test it with all the possible limit cases (even if they are stupid). If there's no problem, then you will... |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,319 Creating a recursive function that returns the factorial will solve this problem.
if 0, then return 1
if 1, then return 1
else do n * fact (n - 1)
This is not a tail-recursive version (sorry... |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,319 What I call a function is something that is not inside a int main(). If you do it with a int factorial() function, you will be able to use it more easily in an another program than a int main().
... |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,319 I will suggest you this:
Write a function that takes an integer and returns its factorial. (Use the power of recursion)
Test it (IMPORTANT!) and after, call it in your program. That will simply... |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,319 So, it is a math problem. Go there:
http://en.wikipedia.org/wiki/Poisson_distribution |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,319 First, indent your code. It is more readable in that way.
Second, how will you find the answer with a pencil and a paper? Answering this question will lead to the structure of your program.... |
Forum: C++ Feb 23rd, 2009 |
| Replies: 2 Views: 333 This is not a C++ question. Just think about how you will represent it and if you have problems with C++, your post will be more likely to be solved.
For the update, do a search on the Observer... |
Forum: C++ Feb 10th, 2009 |
| Replies: 2 Views: 254 Check if you are accessing memory that you have not allocated. Are you using an invalid pointer? Are you using pointers?
Are you referencing an iterator on the end of a vector? (ex: it.end())
... |
Forum: Java Jan 29th, 2009 |
| Replies: 9 Views: 536 You need to put "new Venn()" in your constructor or after the declaration of forstevenn, and make sure that the String object to print is initialized (via new). |
Forum: C++ Jan 29th, 2009 |
| Replies: 9 Views: 461 By the way, try indenting your code like this:
int main()
{
}
or
int main(){
} |
Forum: C++ Jan 29th, 2009 |
| Replies: 9 Views: 461 I don't see brackets surronding the parralelIterative function. If this explains the error, it will be good. Also, a semi-colon after the parralelIterative line is not correct. |
Forum: Java Jan 29th, 2009 |
| Replies: 9 Views: 536 Two possibilities here:
-the String of Venn is null.
-p is null and that is why the message is not printed.
Use System.out.println("Debug messages") to trace the execution of the code. This will... |