An Introduction to C++

The C++ programming language consists of a vocabulary of commands that humans can understand and that can be converted into machine language fairly easily and a language structure (or grammar) that allows humans to combine these C++ commands into a program that actually does something (well, maybe does something)

The vocabulary is often known as the semantics, while the grammar is the syntax.

What's a program?

A C++ program is a text file containing a sequence of C++ commands put together according to the laws of C++ grammar. This text file is known as the source file . A C++ source file carries the extension .CPP just as a Microsoft Word file ends in .DOC or an MS-DOS batch file ends in .BAT. The concept extension .CPP is just a convention, but it's used almost exclusively in the PC world.

The point of programming is to write a sequence of C++ commands that can be converted into a machine language program that does whatever it is that you want done. Such machine executable programs carry the extension .EXE. The act of creating an executable program from a C++ program is called compiling (or building — there is a difference, but it's small).

How do I program?

To write a program, you need two things: an editor to build your .CPP source file with and a program that converts your source file into a machine executable .EXE file to carry out your commands. The tool that does the conversion is known as a compiler.

Nowadays, tool developers generally combine the compiler with an editor into a single work-environment package. After entering your program, you need only click a button to create the executable file.

The most popular of all C++ environments is Microsoft's Visual C++, but the software is expensive. Fortunately, there are public domain C++ environments — the most popular of which is GNU C++. (Pronounce GNU like this: guh NEW). You can download public domain programs from the Internet. Some of these programs are not free — you are either encouraged to or required to pay some usually small fee. You do not have to pay to use GNU C++.

GNU stands for the circular definition "GNU is Not UNIX." This joke goes way back to the early days of C++ — just accept it as is. GNU is a series of tools built by the Free Software Foundation.

GNU C++ is not some bug-ridden, limited edition C++ compiler from some fly-by-night group of developers. GNU C++ is a full-fledged C++ environment. GNU C++ supports the entire C++ language and executes all C++ programs.

GNU C++ is not a Windows development package for the Windows environment. You'll have to break open the wallet and go for a commercial package like Visual C++.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com