Module 3 INTRODUCTION TO C++ PROGRAMMING
The math.h header defines
defines various mathematical functions and one macro. Examples: pow, sqrt
Double Floating Point data type is used for
for storing double precision floating point values or decimal values. Keyword used for double floating point data type is double. Double variables typically requires 8 byte of memory space.
C++ was developed by
Bjarne Stroustrup
Character data type is used
used for storing characters. Keyword used for character data type is char. Characters typically requires 1 byte of memory space and ranges from -128 to 127 or 0 to 255.
Floating Point data type is used for
used for storing single precision floating point values or decimal values. Keyword used for floating point data type is float. Float variables typically requires 4 byte of memory space.
What is a compound statement?
also called a block, is a group of two or more C++ statements enclosed in braces.
Remember that keywords in C++ are
are case sensitive and should be in lowercase.
Lines beginning with a hash or pound sign (#) are
are directives for the preprocessor. They tell the compiler to preprocess the source code before compiling.
Other names which you should not use as variables
are the names of data types such as int, char, float.
C++ is regarded as
as a middle-level language, as it comprises a combination of both high-level and low-level language features.
A variable is also known as
as user-defined identifier. It is a data storage location that has a value, which can change during program execution.
All the elements of the standard C++ library are declared within what is called a
called a namespace, the namespace with the name std (standard).
The function named main is a special function in all C++ programs; it is the function called
called when the program is run. Semi colon is NOT required at the end.
All lines beginning with two slash signs (//) are considered
comments and do not have any effect on the behavior of the program
Boolean data type is used for
d for storing boolean or logical values. A boolean variable can store either true or false. Keyword used for boolean data type is bool.
Integer
data type is used for storing (+/-) whole numbers. Keyword used for integer data types is int. Integers typically requires 4 bytes of memory space and ranges from -2147483648 to 2147483647.
Block Comment Comments can also be expressed as
/* block comments */
What is a program statement?
A statement is a simple or compound expression that can actually produce some effect. Line 7 is a C++ output statement.
Return 0;
This defines the exit status of the process or application.
Wide Character data type is also a character data type but this data type has
has size greater than the normal 8-bit datatype. Represented by wchar_t. It is generally 2 or 4 bytes long.
This specific file (iostream) includes
includes the declarations of the basic standard input-output library in C++ Examples: cin, cout