Everything After The Comment Is A Comment
Everything After The Comment Is A Comment
Note:
/* this type of comment can still be used */
2. Variables can be declared anywhere 3. Data type bool - bool value may be true or false - relational operators produce a bool value - logical operators can work on bool values - can also be used as a controlling expression for if and loops 4. Input and Output statements - uses the header file iostream.h (include only iostream in preprocessing directive) and std namespace - All the files in the C++ standard library declare all of its entities within the std namespace. That is why the using namespace std; statement is included in all programs that used any entity defined in iostream. - cout (console output) Sample usage:
cout<< Hello world.;
- end of line: \n or endl - setting precision for float values: Use iomanip.h
cout<<setprecision(2)<<4.278;
It is now:
void swap(int& x, int& y) { int temp; temp = x; x = y; y = temp; } void main() { int a = 5, b = 10; swap(a,b); }
6. Constant declarations
const float pi = 3.1416;
instead of
#define pi 3.1416
7. Constant reference parameters - declared by writing the keyword const before a reference parameter. This ensures that the programmer is guaranteed that the function can not change the value of the parameter.