You are on page 1of 9

BASIC was originally implemented as a combined computer language and command interpreter

invented in 1964 at Dartmouth College by J. Kemeny and T. Kurtz. it was an important part of a project
to make timeshared computer access available to a large community, in this case Dartmouth College.
It was first implemented on a GE 225 computer. BASIC combines both programming and computer
control into a single interface.

The language is a simple set of variable assignments, control flow and data handling. It was designed
to be easier for most users than Fortran, but the Dartmouth version, surprisingly, included matrix
operations which have not been part of most other implementations. The computer control allows the
user to perform simple commands such as file save & load and program start and stop.

Computer Programming
Computer programming is the craft of writing useful, maintainable, and extensible instructions
which can be interpreted by a computing system to perform a meaningful task. Programming a
computer can be performed in one of numerous languages, ranging from a higher-level language to
writing directly in low-level machine code (that is, code that more directly controls the specifics of the
computer's hardware) all the way to writing microcode (which does directly control the electronics in
the computer).

Common concepts

Programming languages tend to have many general concepts in common. One can examine the
recurring concepts and how they are expressed in various languages in the following table.

edit table

Table of language concepts and how they are expressed in various languages.

Available pages for "Key concepts in programming"

CShar Delph Pytho

Wikicode Asm Ada C C++ Java Perl VB VBNet J2ME
p i n

no page page page page page no page no page no page

page here here here here here page here page here page here

Control no page page page page page page no page page page no
Statements page here here here here here here page here here here page

no page page page page page page no no page page no

page here here here here here here page page here here page

no page page page page page page no page page no no

page here here here here here here page here here page page

Mathematical no page page page page no page no no page page no

calculations page here here here here page here page page here here page

Procedures and no page page page page no page no page page no no

Functions page here here here here page here page here here page page

Function no page no page page no no no no no no no

overloading page here page here here page page page page page page page

Structure and no page page page no page page no no page page no

Style page here here here page here here page page here here page

String no page page page page no page no page page no no

manipulation page here here here here page here page here here page page

no page page page no no page no page no no no

Input and Output
page here here here page page here page here page page page

Memory no page page page page no no no no no no no

Management page here here here here page page page page page page page

no page page page page page no no page page no no

Error handling
page here here here here here page page here here page page

Object Oriented no page no page page page page no page page no no

Programming page here page here here here here page here here page page

Generic no page no page page no no no no no no no

programming page here page here here page page page page page page page

Concurrent no page no page page no no no no no no no

programming page here page here here page page page page page page page

Packages and no page page no page no no no page no no no

Modules page here here page here page page page here page page page

no page page page no no no no no no no no

page here here here page page page page page page page page

Combining no page page no no no no no no no no no

Languages page here here page page page page page page page page page

To see a comparison of syntax in various programming languages, see these "Hello World" examples.
For a list including various computer languages arranged together by syntax terms and patterns, see
Wikipedia's lists of computer syntax patterns.

[edit] Programming skills

Computer programming is really just about solving problems. It turns out that a large number of the
problems you encounter in the real world are really just special cases of a more general problem.
Luckily for you, many of these problems have been studied by computer scientists for a very long time,
sometimes leading to probably unbeatable solutions, or sometimes solutions which are "good enough"
for every day needs. In short, learning a language gives you skills, but learning data structures and
algorithms shows you how to use these skills wisely.

[edit] Introduction

Debugging is the art of diagnosing errors in programs and determining how to correct them. "Bugs"
come in a variety of forms, including: coding errors, design errors, complex interactions, poor user
interface designs, and system failures. Learning how to debug a program effectively, then, requires
that you learn how to identify which sort of problem you're looking at, and apply the appropriate
techniques to eliminate the problem.

Bugs are found throughout the software lifecycle. The programmer may find an issue, a software tester
might identify a problem, or an end user might report an unexpected result. Part of debugging
effectively involves using the appropriate techniques to get necessary information from the different
sources of problem reports.

Computers for Beginners/Programming

[edit] Taking your first step into the world of programming

Computer programming (often simply programming) is the craft of implementing one or more
interrelated abstract algorithms using a particular programming language to produce a concrete
computer program. Programming has elements of art, science, mathematics, and engineering. The
first step to programming is knowing the basics of mathematics (mainly Algebra). Programming is
usually done by writing human-readable code into a text editor and then compiling that code into a
form the computer understands, called binary file.

[edit] Types of programming languages

There are two types of programming languages based on the code or syntax they use. One is low level
and the other is high-level programming languages. The difference between them is on the way we
write their code. For example, Assembly is a low-level language where the user writes code which is
almost identical to the one computers understand (see below for more info). A high-level programming
language uses a more natural and human-readable syntax which makes it easier for humans to
understand and write. The problem with high-level languages is that the programmer doesn't exactly
know how his code will be translated (compiled) into the code the computer understands, thus making
it less powerful compared to the low level languages. Today, most programmers use some sort of a
high-level language, because it is much easier to learn and understand and often requires much less

Low level languages

A typical example of a low-level programming language is Assembly. Assembly offers the lowest level
of programming experience, meaning that one has absolute control over everything the machine will
do. Although this offers programmers the most power, it is very hard to learn and even the most basic
task can require a painful amount of work on the part of the programmer. Once compiled, assembly
programs offer the fastest execution and most precise processor control possible. Assembly is often
used for smaller, speed critical, projects such as writing a device driver, but due to its hard to
understand syntax and complexity, today it is being replaced by high-level languages. The big
difference between low-level and high-level languages is how the code is compiled into the binary
form. Compiler used for compiling Assembly code is named assembler and as programmers say, the
code written is assembled into binary form, not compiled (see under compilers for more details). There
are also many Assembly languages, each for its platform. Although they are extremely hard to use,
they are a very good learning tool, because an Assembly programmer is required to understand how
the machine works (mainly CPU and RAM) in order to write code. MASM (Microsoft's Macro Assembler)
is a popular assembler for the 80x86 (Pentium/Athlon) platform for Windows, others popular
assemblers are TASM (Borland's Turbo Assembler) and the opensource FASM (Flat Assembler). NASM
(The Nationwide Assembler), is currently the most versatile and popular compiler in existence.

Randall Hyde has also written a popular assembler for the 80x86 platform, called HLA (High Level
Assembly) which is an attempt to simplify learning Assembly with a high-level syntax. Although one
can use the high-level syntax, Randall Hyde has repeatedly stressed that a programmer can still code
using a series of CMP's and Jcc's, instead of .IF for example.

High level languages

Due to the fact that the complexity of Assembly language programming is extremely hard to learn,
and written programs are hard to maintain, low-level languages often cannot be ported to another
platform, because they use platform, or, rather, CPU specific instructions, thus written Assembly code
for the PC isn't portable to another platform (such as the Mac for example) without the complete
rewrite of the program. Programmers were in a need for a language that could be easily understood
and be portable, therefore high-level languages were created. The major difference between high-level
and low-level languages is the way they are written and compiled.

While Assembly code is assembled into binary without any modifications than converting the syntax
into CPU instructions, high-level languages use a compiler which also converts code into binary form,
but instead of using a syntax which symbolizes CPU instructions, it used a readable, human-
understandable code, thus making it easier and quicker to write, learn and maintain. The downfall is
that the compiler is responsible for converting the code and often it produces a slower running binary
then Assembly would.

Compilers are extremely good at optimizing code and most of the time produce a binary with the same
running speed Assembly would if used correctly. They are also smart enough to tell us if there's a
problem in our code and sometimes even fix it by themselves. Today, where speed is not as important
as it was many years ago, high-level languages are most programmer's choice.

Although we already know two types of languages, there are also low-level and high-level languages in
high level languages. A programming language may even be high-level and low-level at the same
time. A typical example of this would be C or C++. Both offer low-level operations (even manipulating
the smallest forms known to a computer - bits), but they also offer a natural and easy to use syntax. A
typical example of a fully high-level language would be C# or Java which don't offer any low-level
operations and are thus even easier to learn and write.

The difference between programming language levels is speed - the higher level the language, the
slower the binary and the quicker the learning curve.

The mathematical 'equals' operator ('=') has a different meaning in C so let me explain what this
program does. It takes two numbers, 5 and 10, adds them and stores them in a local variable (which is
stored in RAM) we called 'result'.

Another popular high-level programming language is Microsoft's Visual Basic. It is often used for
learning programming, because of it's ease of use and understanding. All programming languages
require some basic knowledge of mathematics (mainly Algebra) and the basics of how computers
work. Also every programming language serves its purpose. For example, PHP is used for
programming dynamic web pages while C# is used for programming Windows applications and Java is
used for programming platform independent applications.

[edit] How programs work

It is very important that you understand at least the very basics of how computers work, because
learning any languge it is required to know this first. Computers use the processor (CPU) to execute
instructions, memory (RAM) to store the running program and hard drive (HDD) to store data and
programs that are not running at that time. In order for a program to add two numbers like we did in
the previous example, the program must know at compile time and before the program is run, how
much memory it should ask for and what it would store there. Computers use variables to do this.
Variables are data stored in RAM which can be changed any time while the program is running. In our
example, we didn't use variables, but we used constants - plain numbers which can not be changed at
runtime. This, you will find, is extremely useless as most of the time we don't know exactly what our
program will do.

A calculator would be useless without user input and if it could only add numbers that were already
given to him at compile time. Therefore, variables are the primary thing you will get to know at
programming. When you run the program we wrote in C, the program knows it has two numbers in it
and asks the operating system for space in memory for 2 integer numbers. Integer numbers are whole
numbers such as 1, 24 and 1497. Not only does the program have to know how many space it has to
ask, but even what type of a variable it will store. Will it be an integer or a character string?

Whenever one uses a program that asks for user input (a calculator for example) it has already made
place in RAM for the number one will type in. When you do type it in, it stores it in that place and
marks its type - if you type in 33 it will mark it as an integer, if you typed in 3.14 it will mark it as a real
Real numbers are numbers with fractions. For example 1.33 is a real number, so is 0.25 and so on.
Knowing what type of a variable the program stores, it knows what it can do with it. So if we have real
numbers or integers we can multiply them, divide them etc. But we can not do those things with a
character string. We can't divide words and letters.

The other major thing to know about programming is that computers can't think. Computers are pretty
much useless machines without a human to operate it. The computer does exactly what you tell it to
do and nothing more. This, as you have probably notice, doesn't seem true all the time, but it is almost
never the computer's fault and almost always programmer's. Computers do not understand numbers,
words or any other human-readable type. They can only understand two states; true and false.

You have probably heard that computers work with 1's and 0's but that is not the case. They work with
electricity and nothing more. We made up those 1's and 0's to make it simplier for us to understand
them. (1's and 0's represent voltage changes).Computers cannot think or do anything useful without
someone programming it. They can only compare numbers and nothing else. It is important to know
this, so you start thinking as a computer programmer.

[edit] Programming Languages

The purpose of programming is to tell the computer what to do. Computers are better at doing some
things than you are, like a chef is better at cooking than you are. It's easier to tell a chef to cook you a
meal than to cook it yourself. The more precise you are in your request, the more your meal will turn
out how you like it. In most scenarios like this in real life, small amounts of ambiguity and
misinterpretation are acceptable. Perhaps the chef will boil your potato before mashing it instead of
baking it. With computers, however, ambiguity is rarely acceptable. Programs are so complex that if
the computer just guessed at the meaning of ambiguous or vague requests, it might cause problems
so subtle that you'd never find them. Programming languages, therefore, have been designed to
accept only completely clear and unambiguous statements. The program might still have problems,
but the blame is then squarely on you, not on the computer's guess. Much of the difficulty in
programming comes from having to be perfectly precise and detailed about everything instead of just
giving high-level instructions.

Some languages require total and complete detail about everything. C and C++ are such languages,
and are called low-level languages. Other languages will make all sorts of assumptions, and this lets
the programmer specify less detail. Python and Basic are such languages, and are called high-level
languages. In general, high-level languages are easier to program but give you less control. Control is
sometimes important, for example if you want your program to run as quickly as possible. Most of the
time total control and speed aren't necessary, and as computers get faster high-level languages
become more popular. Here we will deal exclusively with high-level languages. Low-level languages
are generally similar except there's often more lines of code to write to accomplish the same thing.

C++ Programming/Programming Languages/C++

Introducing C++

C++ (pronounced "see plus plus") is a general-purpose, object-oriented, statically typed, free-form,
multi-paradigm programming language supporting procedural programming, data abstraction, and
generic programming. During the 1990s, C++ became one of the most popular computer
programming languages.

[edit] History

Bjarne Stroustrup a Computer Scientist, from Bell Labs was the designer and original implementer of
C++ (originally named "C with Classes") during the 1980s as an enhancement to the C programming
language. Enhancements started with the addition of classes, followed by, among many features,
virtual functions, operator overloading, multiple inheritance, templates, and exception handling, these
and other features are covered in detail along this book.

The C++ programming language is a standard recognized by the ANSI (The American National
Standards Institute), BSI (The British Standards Institute), DIN (The German national standards
organization), several other national standards bodies, and was ratified in 1998 by the ISO (The
International Standards Organization) as ISO/IEC 14882:1998, consists of two parts: the Core Language
and the Standard Library; the latter includes the Standard Template Library and the Standard C Library
(ANSI C 89).

Features introduced in C++ include declarations as statements, function-like casts, new/delete, bool,
reference types, const, inline functions, default arguments, function overloading, namespaces,
classes (including all class-related features such as inheritance, member functions, virtual functions,
abstract classes, and constructors), operator overloading, templates, the :: operator, exception
handling, run-time type identification, and more type checking in several cases. Comments starting
with two slashes ("//") were originally part of BCPL, and was reintroduced in C++. Several features of
C++ were later adopted by C, including const, inline, declarations in for loops, and C++-style
comments (using the // symbol).

The current version, which is the 2003 version, ISO/IEC 14882:2003 redefines the standard language
as a single item. The STL that pre-dated the standardization of C++, and was originally implemented
in Ada is now an integral part of the standard and requirement for a compliant implementation of the
same. Many other C++ libraries exist which are not part of the Standard, such as Boost. Also, non-
Standard libraries written in C can generally be used by C++ programs.

Since 2004, the standards committee (includes Bjarne Stroustrup) has been busy working out the
details of a new revision of the standard, that has been temporarily titled C++0x, due publication in
the end of 2011. Some implementations already support some of the proposed alterations.

C++ source code example

// 'Hello World!' program

#include <iostream>

int main()

std::cout << "Hello World!" << std::endl;

return 0;

Traditionally the first program people write in a new language is called "Hello World." because all it
does is print the words Hello World. Hello World Explained offers a detailed explanation of this code;
the included source code is to give you an idea of a simple C++ program.

[edit] Overview

Before you begin your journey to understand how to write programs using C++, it is important to
understand a few key concepts that you may encounter. These concepts are not unique to C++, but
are helpful to understanding computer programming in general. Readers who have experience in
another programming language may wish to skim through or skip this section entirely.

There are many different kinds of programs in use today. From the operating system you use that
makes sure everything works as it should, to the video games and music applications you use for fun,
programs can fulfill many different purposes. What all programs (also called software or
applications) have in common is that they all are made up of a sequence of instructions written in
some form of programming language. These instructions tell a computer what to do, and generally
how to do it. Programs can contain anything from instructions to solve math problems or send emails,
to how to behave when a video game character is shot in a game. The computer will follow the
instructions of a program one instruction at a time from start to finish.
[edit] Why learn C++?

Why not? This is the most clarifying approach to the decision to learn anything. Although learning is
always good, selecting what you learn is more important as it is how you will prioritize tasks. Another
side of this problem is that you will be investing some time in getting a new skill set. You must decide
how will this benefit you. Check your objectives and compare similar projects or see what the
programming market is in need of. In any case, the more programming languages you know, the

If you are approaching the learning process only to add another notch under your belt, that is, willing
only to dedicate enough effort to understand its major quirks and learn something about its dark
corners then you should be best served in learning first two other languages, this will clarify what
makes C++ special in its approach to programming problems. You should select one imperative
language, and in this C will probably have a better market value and will have a direct relation to C++
(a good substitute would be ASM) and the second language should be an Object Oriented language like
Java for the same reasons, as there is a close relation between the three languages.

If you are willing to dedicate a more than passing interest in C++ then you can even learn C++ as
your first language, but dedicate some time understanding the different paradigms and why C++ is a
multi-paradigm language, or how some like to call it, a hybrid language.

Learning C is not a requirement for understanding C++, but knowing how to use an imperative
language is, C++ will not make it easy for you to understand and distinguish some of this deeper
concepts, since that in C++ you are free to implement solutions with a greater range of freedom.
Understanding what options to make will become the cornerstone of mastering the language.

You should not learn C++ if you are only interested in applying or learning about Object Oriented
Programing since the nomenclature used and some of the approaches C++ takes to the problem will
probably increase the difficulty level in learning and mastering those concepts, if you are truly
interested in Object Oriented programming, the best language for that is Smalltalk.

As with all languages C++ has a specific scope of application, where it can truly shine, and if we take a
quick comparison with the previous mentioned languages, C++ is harder to learn than C and Java but
more powerful than both. C++ enables you to abstract from the little things you have to deal with in C
or other lower level languages but will grant you a bigger control and responsibility than Java, but it
will not provide the default features you can obtain in similar higher level languages. You will have to
search and examine several external implementations of these features and freely select those that
best serve your purposes or you may even have to implement your own solution.

[edit] Where to get a compiler

When you select your compiler you must take in consideration your system OS, your personal
preferences and the documentation that you can get on using it.

One of most actualized and compatible compilers is GCC. The next section will show how to get a copy
and install it on Windows. You can easily find information on the GCC website on how to do it under
another OS. GCC is a decent choice, and can be obtained for free. Many Open Source platforms include
a recent GCC version. Version 4.0 or later gives fairly good conformance to the C++ standard. Various
IDEs are available to support GCC. For Windows, Microsoft Visual Studio Express is currently available
free of charge (but not free as in non-proprietary) with a C++ compiler that can be used from the
command line or from the supplied IDE. An IDE, or Integrated Development Environment, is generally a
graphical environment which integrates functionality like editing, compiling, linking, and usually a help
system etc.).

In Appendix B:External References you will find references to other freely available compilers and
even full IDEs you can use.

[edit] GCC
The GNU Compiler Collection is a free set of compilers developed by the Free Software Foundation,
with Richard Stallman as one of the main architects.

There are many different pre-compiled GCC binaries on the Internet, some popular choices are listed
below (with detailed steps for installation).

[edit] On Windows


Go to and click on the "Install Cygwin Now" button in the upper right corner of
the page.

Click "run" in the window that pops up, and click "next" several times, accepting all the default

Choose any of the Download sites ("", etc.) when that window comes up; press "next"
and the Cygwin installer should start downloading.

When the "Select Packages" window appears, scroll down to the heading "Devel" and click on the "+"
by it. In the list of packages that now displays, scroll down and find the "gcc-c++" package; this is the
compiler. Click once on the word "Skip", and it should change to some number like "3.4" etc. (the
version number), and an "X" will appear next to "gcc-core" and several other required packages that
will now be downloaded.

Click "next" and the compiler as well as the Cygwin tools should start downloading; this could take a
while. While you're waiting, go to and download that free programmer's
editor; it's powerful yet easy to use for beginners.

Once the Cygwin downloads are finished and you have clicked "next", etc. to finish the installation,
double-click the Cygwin icon on your desktop to begin the Cygwin "command prompt". Your home
directory will automatically be set up in the Cygwin folder, which now should be at "C:\cygwin" (the
Cygwin folder is in some ways like a small Unix/Linux computer on your Windows machine -- not
technically of course, but it may be helpful to think of it that way).

Type "g++" at the Cygwin prompt and press "enter"; if "g++: no input files" or something like it
appears you have succeeded and now have the gcc C++ compiler on your computer (and
congratulations -- you have also just received your first error message!).

MinGW + DevCpp-IDE

Go to, choose the version you want (eventually scrolling down),

click on the appropriate download link! For the most current version, you will be redirected to

Scroll down to read the license and then to the download links. Download a version with Mingw/GCC.
It's much easier than to do this assembling yourself. With a very short delay (only some days) you will
always get the most current version of mingw packaged with the devcpp IDE. It's absolutely the same
as with manual download of the required modules.

You get an executable that can be executed at user level under any WinNT version. If you want it to be
setup for all users, however, you need admin rights. It will install devcpp and mingw in folders of your

Start the IDE and experience your first project!

You will find something mostly similar to MSVC, including menu and button placement. Of course,
many things are somewhat different if you were familiar with the former, but it's as simple as a
handfull of clicks to let your first program run.

[edit] For DOS

Go to Delorie Software and download the GNU C++ compiler and other necessary tools. The site
provides a Zip Picker in order to help identify which files you need, which is available from the main

Use unzip32 or other extraction utility to place files into the directory of your choice (ie. C:\DJGPP).

Set the envionment variables to configure DJGPP for compilation, by either adding lines to
autoexec.bat or a custom batch file:



If you are running MS-DOS or Windows 3.1, you need to add a few lines to config.sys if they are not
already present:

shell=c:\dos\ c:\dos /e:2048 /p



Note: The GNU C++ compiler under DJGPP is named gpp.

[edit] For Linux

For Redhat, get a gcc-c++ RPM, e.g. using Rpmfind and then install (as root) using rpm -ivh gcc-c+

For Fedora Core, install the GCC C++ compiler (as root) by using yum install gcc-c++

For Mandrake, install the GCC C++ compiler (as root) by using urpmi gcc-c++

For Debian, install the GCC C++ compiler (as root) by using apt-get install g++

For Ubuntu, install the GCC C++ compiler by using sudo apt-get install g++

If you cannot become root, get the tarball from and follow the instructions in it to
compile and install in your home directory.

[edit] For Mac OS X

Xcode has GCC C++ compiler bundled. It can be invoked from the Terminal in the same way as Linux,
but can also be compiled in one of XCode's projects.