Hello World? What Do You Even Mean!?: #Include
Hello World? What Do You Even Mean!?: #Include
#include <iostream> // Lines beginning with a hash sign (#) are directives read and interpreted by
what is known as the preprocessor.
int main() //The function named main is a special function; it is the function called when
the program is run. The execution of all programs begins with the main function.
{
A sentence within quotes
cout << "Hello world!" << endl; //cout-> Character output ("Hello world!"), is the
content inserted into the
//<< insertion operator standard output(your
computer screen).
return 0;
Note!
} The statement ends with
a ; and this symbol
marks the end of a
statement.
IMPORTANT: cout is part of the standard library, and all the elements in the standard C++ library are
declared within a namespace called std. The most typical way to insert components in the standard
output(your computer screen) is by means of using declarations:
In simple words, it tells the compiler to process this statement first or it means that it
gives the statement a high priority.
1. If statement
2. If..else statement
3. Switch statement
4. Nested if statement
5. Nested switch statement Examples done in
There are 3(okay, 4) ways a loop can be represented in c++ class, pay attention!
1. For
2. While
3. Do..while
4. Nested loop
Conditional operator
The value of a ? expression is determined like this: Exp1 is evaluated. If it is true, then Exp2 is
evaluated and becomes the value of the entire ? expression. If Exp1 is false, then Exp3 is evaluated
and its value becomes the value of the expression.
The ? is called a ternary operator because it requires three operands and can be used to replace if-
else statements, which have the following form:
if(condition){
var = X;
}else{
var = Y;
}
Functions
Arrays
or
cout<<room_no[3];
Inheritance of a class
Multiple inheritances