Fundamentals of Programming using C++


[Top] [Topic] [Task] [Test] [TTT index]

Topic 1: Getting started.

General advice about learning to program.

Programming, in any language, is not difficult to learn. Programming is however considered as a "hard" part of computing when it is compared with other "soft" computing activities like using a word processing or an accounting package.

In the "soft" activities you work inside a program that someone else has written, using just the facilities they have designed for you, to achieve a single, well-defined outcome. When programming you are instead using an elementary set of tools to achieve an outcome which can be anything you wish it to be.

A successful approach to learning to program depends heavily on large amounts of practice. You will need to write many programs and build up your experience and memory as you go. Although a logical mental attitude helps you to write programs, you do not have to be trained in formal logic - common sense is enough. You don't have to have studied mathematics either.

All programming languages contain special words and syntax, but you don't have to learn the words and syntax before you start programming - you learn it as you go.

Designing and writing the programs used in this course won't be difficult. Straighforward examples will be used which will help you to gradually build up your skills.

Program development.

Before you can write a computer program to solve a particular problem you have to understand the problem and be able to break it down into actions which can be executed by a computer.

The individual steps you have decided on in your solution must be written in a computer programming language (the source code). You use an editor to do this. The source code must then be converted into machine codes that the computer's microprocessor can understand (Compiled). This is done by another computer program called a compiler. Compilers usually also combine (Link) your program with some system files so your program can finally be run (Executed) by the computer.

Problems and Errors.

There are three places where errors can occur. The first happens when you misspell a keyword or get some punctuation wrong in your source code - this is called a syntax error. The compiler will find and report syntax errors to you when it tries to compile your program and you will soon get used to fixing these.

The second kind of error (and one which is usually harder to fix) is an error of logic. In this case, the program compiles without any syntax errors but when it runs, the results aren't accurate. In this case you have to check your program design to see if any important steps are missing or wrong and adjust your source code to match the new arrangement.

The last kind of errors are runtime errors. These occur while your program is running and they cause the program to terminate immediately the error happens. These can be disconcerting but you should not get too concerned - no damage is done to your computer.


[Top] [Topic] [Task] [Test] [TTT index]

A little theory

  1. Look up the words edit , compile , link , and execute in an ordinary dictionary. Look these same words up in a computing text book. Compare the meanings.
  2. Write down (in plain English) the logical steps which are performed when you brush your teeth. Assume that your set of steps is going to be used by a five year old person who is about to brush their teeth for the first time.

[Top] [Topic] [Task] [Test] [TTT index]

Test1 - Getting started

Click here to try this topic's test


[Top] [Topic] [Task] [Test] [TTT index]
Author:
Errol Chopping
Lecturer in Computing
Charles Sturt University - Mitchell
Bathurst NSW 2795
Australia.
Last Update: Nov 15, 1995