Programming is usually very hard on the beginner. When you first sit down to study a language the first thing they teach you is I/O, meaning input and output. How to communicate with the computer. As much as that is important, and it IS the basics to it all, there is something they should teach first - THE WAY YOU THINK.
A begining programmer, if asked to write a program that calculates and average of 20 grades, will start by writing the program. So, first the programmer will write the basic starting lines of the programming language he/she is using and then the program starts and...nothing. Now, I am using a very simple example, one which probably 100% of all software engineers out there will write automatically.
But in general, BEFORE you write the program, take a piece of paper and write the stages. This is called and algorithm and it is very important to get used to writing them because programs will only get harder and bigger.
So an algorithm for the average example will look something like this:
Calculate average: Add all elements and divide by number of elements.
Adding: initiate variable sum, initiate variable counter
1.read element from user
2.add to sum the element read
3.add one to counter
4.if counter is not yet 20, not all elements have been read. Go back to step (1).
Dividing: average=sum/20
print the sum.
First what you do is write the names of the steps: add all elements, divide by number of elements
Then you write the basic steps inside the steps you have written. Slowly you work your way deeper and deeper into each step until your algorithm is complete. Once you're done "translate" it to whatever software you are using.
Remember this as a basic rule in software engineering: you do not just write the program. You work through it, writing step by step.
Good luck.
