Advertisement

C++ Workshop - Functions, Parameters, & Scope (Ch. 5)

Started by June 26, 2006 12:22 PM
45 comments, last by me_minus 15 years, 5 months ago
Thanks for the explanation nobodynews, that made perfect sense.

I get it why you wouldn't use the function call in the expression the way I did it. Just didn't think further in that there could be a value returned with -1 as a result!!!
Hey, thanks for this chapter, I'm looking forward to finishing the book. Your quizzes are really helpful too. After I answer the quiz I check my answers and almost always learn something.

It's a shame I'm a bit late on this but I can still learn can't I?

Have Fun!
Dbproguy
--Dbproguy - My Blog - Tips, Opinions and Reviews about C++, Video Games, and Life
Advertisement
Hello im new here and the c++.

I need to learn how progress that recursion @ listing 5.10

when i enter 6 for n variable its natural return( fib(n-2) + fib(n-1)); is making progress but its don't stop after one process.

i have seen codes and figure 5.4-5.5. i know what it does but i want to learn
why its doing it.

i was searching good book for c++ and i found here with c++ book advice+wonderful workshop.

But my english doesn't well enough to understand everything in that book(i am looking dictionary all time) and local
sources from my main language not enough for my needs.

So if you have time i need a little- simple english - information about this.

waiting for your reply with impatience.

Thanks.





i solved this myself.

i was miss the "return (deh(n-2)+deh(n-1));" line i did not interest with this line when i searching solution.

easy one.




[Edited by - Psiacron on July 29, 2008 8:17:24 AM]
Not sure if you guys still browse this posting, but I have a problem. I am working on Day 5 Exercise 7:

Write a program that asks for a number and a power. Write a recursive function
that takes the number to the power. Thus, if the number is 2 and the power is 4, the function will return 16.

I have the main part written but cannot think of how to write the Power function to perform the calc, I could prob do a Do While of For Next, but I have not gotten to that part of the book yet. Can someone give me some pointers as to where to start, not answers just hints :).

Thanks
The key is a RECURSIVE function.

This topic is closed to new replies.

Advertisement