The whole idea of those books is to show you commands step by step in a manner where they encourage you to jump into a compiler and experiment.
For example, they may teach you what a For loop does; what they want you to do is start thinking what you could do with that For loop... hmm maybe I could loop 12 times and have my program do my multiplication tables for someone learning them.. cool..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <iostream>
using namespace std;
int main()
{
int number;
cout << "Enter table: ";
cin >> number;
for (int table = 1; table <= 12; table++)
cout << table << " x " << number << " = " << table * number << endl;
return 0;
}
|
Enter table: 12
1 x 12 = 12
2 x 12 = 24
3 x 12 = 36
4 x 12 = 48
5 x 12 = 60
6 x 12 = 72
7 x 12 = 84
8 x 12 = 96
9 x 12 = 108
10 x 12 = 120
11 x 12 = 132
12 x 12 = 144
|
Experiment, practice and practice more.. programming doesnt happen overnight. Its all about patience, and the ability to problem solve. If your going to the next section and forgetting the one before then you shouldn't be moving on.
For loops, IF statements and all those other commands that are demonstrated in the book, those little examples may not be much but what they are trying to do is give you a understanding of program flow control (
http://www.cplusplus.com/doc/tutorial/control/).
Flow control is needed in everyday applications and games, all those lovely game engines your favourite games run under all need flow control.. has the player walked into a wall?, has all his lives gone?
A good programmer comes with practice, no book will teach you that, they can only show you the commands and syntax.
Happy coding :)