You are on page 1of 15

Chapter 2:1

First Program
 C++ programs development
Dev C++
• Is an IDE (Integrated Development Environment) used to edit AND
compile the code.
• Other IDEs: code blocks, Eclipse, and Visual Studio.
Statement
• A statement is a type of instruction that causes the program to perform
some action.
Function
• A function is a collection of statements that get executed sequentially (in
order, from top to bottom).
• Every C++ program must have a special function named main (all lower
case letters). When the program is run, the statements inside of main are
executed in sequential order.
First C++ program
Syntax errors
• Let’s see what happens if we omit the semicolon on line 5 of the “Hello
world” program, like this:
Syntax error
• A syntax error is a compiler error that occurs at compile-time when your
program violates the grammar rules of the C++ language.
Standard Library
• The C++ Standard Library is a library that is in C++ and contains
additional functionality to use in your programs.
Comments
• A comment is a programmer-readable note that is inserted directly into
the source code of the program.
• Comments are ignored by the compiler and are for the programmer’s use
only.
Types of comments
• Single-line comments:
• Single-line comments start with two forward slashes (//).
• Any text between // and the end of the line is ignored by the compiler
(will not be executed).
• These are short comments.
C++ Multi-line Comments

• Multi-line comments start with /* and ends with */.


• Any text between /* and */ will be ignored by the compiler
• These are long comments.

You might also like