Recent content by Anteros
-
A
How Does Recursion Work in C for Calculating Factorials?
I think the misunderstanding might just be in the if/else syntax. if (a==1) return 1; else { a *= factorial(a-1); //calls the factoral function. //The above calls the factoral function from within the factorial function. return a; } is equivalent to...- Anteros
- Post #8
- Forum: Programming and Computer Science
-
A
How i can use a bitmap as background image?
That's fine, this class doesn't have to be used from MFC. In fact, it's an ATL class so it's not native MFC at all. Just create an instance of the PictureWindow class and call the SubclassWindow() method on this class giving it a HWND. This can be a handle to a dialog, control, whatever...- Anteros
- Post #9
- Forum: Computing and Technology
-
A
How i can use a bitmap as background image?
Ok, so if in fact we are talking about MFC, there is a pretty useful class which I use from time to time over on Codeproject http://www.codeproject.com/bitmap/picturewindow.asp . It extends an ATL window class so you have to insert a couple lines (most likely in your stdafx.h) #include <...- Anteros
- Post #6
- Forum: Computing and Technology
-
A
How i can use a bitmap as background image?
What are you trying to set the background of? I am racking my brain trying to think of something in which the background is a number but can't. Start over from the beginning and tell us exactly what you are trying to set the background of, on what platform, in what programming language and...- Anteros
- Post #4
- Forum: Computing and Technology
-
A
Extremely frustrating C program
Yes, I suppose you could think of it that way. All of the local variables in a function are kept on the stack (in memory) until they go out of scope. So in this case, startindex is 0 in the 1st call to somefunction(), 1 in the 2nd call to somefunction(), etc. When the 2nd call to...- Anteros
- Post #12
- Forum: Computing and Technology
-
A
Extremely frustrating C program
It doesn't "break out" of somefunction(), that invocation of somefunction simply returns. And the point at which it returns is right after the point at which it was called. You have to think about it step by step. Try thinking about it this way. Each line is a single step in the program...- Anteros
- Post #10
- Forum: Computing and Technology
-
A
Extremely frustrating C program
Also, the example TenNen referred to is a good one. What happens if you reverse the order of the printf() and somefunction() calls. i.e. printf( "%d ", b[ startIndex ] ); someFunction( b, startIndex + 1, size ); Now you have something like this (simplified) printf(0)...- Anteros
- Post #8
- Forum: Computing and Technology
-
A
Extremely frustrating C program
somefunction(a, 9, 10) ..somefunction(a, 10, 10) <- will this call somefunction() or print anything? Since somefunction(a, 10, 10) doesn't pass the conditional if statement it returns and breaks the recursion. Now what happens? Which function call are you in now? In other words...- Anteros
- Post #7
- Forum: Computing and Technology
-
A
Extremely frustrating C program
Think about what happens sequentially in the code and figure out when the first printf() is hit. The best way to visualize recursion like this is to write down the recursive function calls with arguments. So... somefunction(a, 0, 10) somefunction(a, 1, 10) somefunction(a, 2, 10)...- Anteros
- Post #4
- Forum: Computing and Technology
-
A
Undergrad Finding the Sum of n/[(n+1)(n+2)(n+3)]
I just worked this out and the answer is in fact 1/4. Zurtex has the right approach. Find A, B and C and then write out the first several terms for each partial fraction. You should see a bunch of them cancel and you'll be left with a couple terms per fraction. From there, you can see the limit.