Forum: C++ Sep 1st, 2009 |
| Replies: 9 Views: 381 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: 573 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: 389 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: 389 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: C++ Apr 5th, 2009 |
| Replies: 10 Views: 493 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: 493 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: 493 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: 493 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: 356 Don't forget to make the thread as solved. |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 356 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: 356 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: 356 Ok, first, it is very ugly to do:
string(change.begin() +i,change.begin() +i+1)
Instead, do this:
change[i] |
Forum: C++ Mar 2nd, 2009 |
| Replies: 18 Views: 682 You should put the numbers at some place... and check every one of them...
That is an extremely easy solution. |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,210 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,210 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,210 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,210 So, it is a math problem. Go there:
http://en.wikipedia.org/wiki/Poisson_distribution |
Forum: C++ Feb 23rd, 2009 |
| Replies: 12 Views: 1,210 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: 320 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: 246 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: C++ Jan 29th, 2009 |
| Replies: 9 Views: 455 By the way, try indenting your code like this:
int main()
{
}
or
int main(){
} |
Forum: C++ Jan 29th, 2009 |
| Replies: 9 Views: 455 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. |