This lesson is an introduction to computing and to the language C++. We will focus attention on telling computers how to do things. We will get an overall view of languages and how programs are put together. We'll also examine a simple C++ program to get a sense of what the language C++ looks like.
A computer program is a set of instructions for a computer to perform a certain task.
Each computer can follow instructions written in its native machine language. People write programs in high-level languages.
The term code refers to instructions written in a computer language. Machine language code is stored in binary files as opposed to text files, which can be viewed and modified in a text editor.
A compiler is a program that translates high-level language code into machine language code.
A library is a collection of code to perform a set of related tasks.
Compiler output is an executable file, which is a set of computer instructions in machine language.
// Our First C++ Program Line 1 #include <iostream.h> // Line 2 // Line 3 void main() // Line 4 { // Line 5 cout << "Hello World" << endl; // Line 6 } // Line 7
There is one statement in main()
% CC -o hello hello.CExecuting the code generated by the compiler in that same command-line environment requires this command.
% helloWhen the code executes, it will print the message Hello World on the terminal.