Today was loop day. I finished up learning about if statements, and found all the answers to Friday's questions at the bottom of the tutorial page! I just hadn't read that far. As for loops, I found that they were also pretty easy, except for the last one. There are three different loop formats: For, While and Do-While. Essentially, For loops do whatever is in the parentheses and display the output. While loops is when the integer is true, do the following function. I'll have to revisit Do-While loops and work with them until I fully understand their use.
My current trend of doing the tutorials is to write a code that is similar to the tutorial yet expanded slightly, then incorporate some aspect of the previous lesson into the program. Because I was working with if statements before, I put an if statement into this program. The basic gist of it is:
It asks you for a number.
You give a number.
If you give a certain number it displays a message.
Otherwise it counts up by increments of 1 to the number you give.
After working with C++ for a good while now (actually only a week) things seem to be coming easier to me. I understand what functions do. The only previous coding experience was Visual Basic. The one difference between VB and C++ is that VB likes words/text whereas C++ has more shorthand codes.
More on Wednesday.
Monday, January 28, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment