Quote:
*
* *
* * *
* * * *
* * * * *
* * * * * *
It is nice to draw actual wrong output, it is better to draw the output you want. It is also more informative for us.
Your job is to analyze the problem:
- draw the triangle you want to get.
- write down the sequence of steps (with number of times) to get the result.
- identify repeating patterns.
- write the program
- use the debugger to understand why some parts fails, and probably how to correct them.
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[
^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
Learn one or more analyse methods, I recommend
E.W. Djikstra top-Down analyse method, it is a good start.
https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design[
^]
https://en.wikipedia.org/wiki/Structured_programming[
^]
https://en.wikipedia.org/wiki/Edsger_W._Dijkstra[
^]
https://www.cs.utexas.edu/users/EWD/ewd03xx/EWD316.PDF[
^]