Some of the most basic concepts of C ++

1. The input and output

  In C ++, how undefined input and output statements using a comprehensive standard library to provide IO mechanism. And we often use iostream library contains two basic types istream and ostream, respectively, the input and output streams. A string is a sequence flow.

  4 IO defined in the standard library objects, an object type named istream cin (the standard input), the ostream object type (Standard Output) cout named, entitled osream cerr and clog the object.

  Writing data to the stream - output operator (<<), << operator accepts two operands, a left side is an ostream object, the right operand is the value to be printed. This operator is given the value written to the given ostream object. Calculating an output result is left operator operands (i.e., the calculation result is written to us that the ostream given value).

  Namespace - the namespace can help us avoid inadvertently names defined conflict, conflict and the use of the library of the same name caused all the standard library names are defined in the namespace std.

  Read from the data stream - the input operator (>>), >> operator also accepts two operands, a is an istream left, right operand is the value to be entered.

2. Comment

  There are two C ++ Notes: single-line and delimiters annotation. Single-line comments begin with a double slash (//), terminated by a newline. Another C language using inherited from two delimiters (/ * * /). Note begin with / * to * / end, the intermediate content may comprise any other * / outside.

3. Control Flow

  General statement is executed sequentially, but programming language offers a variety of control-flow statements, can write more complex execution paths.

  • while statement, a piece of code is repeated until a given condition is false so far
  • for statement
  • The if statement

4. namespace declaration using

  In the using statement after without adding a special prefix, such as using using namespace :: name; later, you can access the namespace name directly. The general should not be included in the header file using the statement. This is because the contents of header files will be copied to all references to it in the file, if the header file, there are a using statement, then each use the header file will have this statement, for some programs, the Because inadvertently included some names, it may produce unexpected name conflicts.

 

...

Guess you like

Origin www.cnblogs.com/taoye1997/p/11895603.html