View Single Post
  #4 (permalink)  
Old September 8th, 2003, 11:11 PM
nikolai nikolai is offline
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Bear in mind that none of us are here to do your homework for you. I understand that this is a useful QnA forum, but in my opinion, you don't learn as effectively as you would by working out the problems yourself or going over them with a teacher or tutor.

When a student is first learning how to program, regardless of language, getting the questions answered isn't nearly as important as learning how to solve the problems. Once you have worked hard (and it can be difficult!) to develop strong analytical and problem-solving skills, you can apply those skills to problems in a multitude of languages.

The goal, therefore, is not to teach you how to program in C++, but rather, how to solve problems using C++ as the language in which you express your solutions.

I hope I'm making sense!

When I tutored fellow students in C, C++, and Java, the best pieces of advice I gave them were:

1) Think about the problem and answer in English (or whatever your native language is). Try and come up with a reasonable answer that you could tell someone. This answer doesn't have to be as details as line-by-line pseudocode.

2) Draw everything out. Diagram your memory, both stack and heap. The stack is where function parameters and local variables are created. The heap is where dynamically allocated memory is taken. Write down a list of all your important variables and keep track of their values as you trace through your program. Do this on a whiteboard or with pencil and paper. I call this "manual debugging". Most people would suggest using an actual debugger application to step through their code, but I think doing it by hand forces you to look much more closely at your own program logic and discover flaws and subtle bugs that would ordinarily stump you for a while. This is especially true when writing loops or recursive functions.


That said, if you're STILL having problems, ask for general help relating to your problem, but don't ask about your problem.



Take care,

Nik
http://www.bigaction.org/
Reply With Quote