Sunday, March 12, 2017

C++ Part 16

Review to C++ Basics

C++ is case sensitive. For example, count and COUNT are two different identifiers.
Use meaningful names for variables.
Variables must be declared before they are used. Other than following this rule, a
variable declaration may appear anyplace.

Be sure that variables are initialized before the program attempts to use their value.
This can be done when the variable is declared or with an 
assignment statement before
the variable is first used.

You can assign a value of an integer type, like int, to a variable of a floating-point
type, like 
double, but not vice versa.

Almost all number constants in a program should be given meaningful names that
can be used in place of the numbers. This can be done by using the modifier 
constin a variable declaration.

Use enough parentheses in arithmetic expressions to make the order of operations clear.
The object cout is used for console output.
A \n in a quoted string or an endl sent to console output starts a new line of output.
The object cerr is used for error messages. In a typical environment, cerr behaves
the same as 
cout.The object cin is used for console input.

In order to use cin, cout, or cerr, you should place the following directives near
the beginning of the file with your program:
#include <iostream>using namespace std;

There are two forms of comments in C++: Everything following // on the same line
is a comment
, and anything enclosed in/* and */ is a comment.

Do not over comment. 

__________________
Source: Absolute C++ by Walter Savitch , Kenrick Mock

No comments:

Digital Design Part 3

4th→ assembler translates it to the machine language. 1.6 [20] <§1.6> Consider two diļ¬€erent implementations of the same instru...