



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Chapter No#
When we consider a C++ program, it can be defined as a collection of objects that communicate via invoking each other's methods. Let us now briefly look into what a class, object, methods, and instant variables mean.
Let us look at a simple code that would print the words Hello World. #include
Let's look at how to save the file, compile and run the program. Please follow the steps given below ā
In C++, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity. For example, following are three different statements ā x = y; y = y + 1; add(x, y); A block is a set of logically connected statements that are surrounded by opening and closing braces. For example ā { cout << "Hello World"; // prints Hello World return 0; }
char float reinterpret_cast Typename class for return Union const friend short Unsigned const_cast goto signed Using continue if sizeof Virtual default inline static Void delete int static_cast Volatile do long struct wchar_t double mutable switch While dynamic_cast namespace template
A few characters have an alternative representation, called a trigraph sequence. A trigraph is a three-character sequence that represents a single character and the sequence always starts with two question marks. Trigraphs are expanded anywhere they appear, including within string literals and character literals, in comments, and in preprocessor directives. Following are most frequently used trigraph sequences ā Trigraph Replacement
??= # ??/
??' ^ ??( [ ??) ] ??! | ??< { ??> } ??- ~ All the compilers do not support trigraphs and they are not advised to be used because of their confusing nature.
A line containing only whitespace, possibly with a comment, is known as a blank line, and C++ compiler totally ignores it. Whitespace is the term used in C++ to describe blanks, tabs, newline characters and comments. Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statement, such as int, ends and the next element begins.
int age; In the above statement there must be at least one whitespace character (usually a space) between int and age for the compiler to be able to distinguish them.