Home > database >  Sequential structure program design
Sequential structure program design

Time:10-08

Knowledge (symbol is English in the process of the whole state)
A cout statement which is output.
Such as the front should have elements and relational expression to output,
The header file # include
coutInput the double quotes itself, such as input "a" outputs a
Single output ASCII code 65, a is a byte,
When used in integer arithmetic int a, b, c, ans; (ans is the multiplication sign)
After input a=1; B=2; C=3;
C==a + b; Ans=b * c;
Cout & lt; <" Ans="& lt; 2. 4 bytes data type a character, a letter a byte
The integer 1. Specific type int bytes 4 values range - 2147483648 ~ 2147483647
Short 2-32768-32767
Long 4-2147483648-2147483647
Long long 8-2 ^ 63 ~ 2 ^ 63-1
Bool 1 0 or 1
Char - 128 ~ 1 127 * ASCII
Float 4 6 ~ 7 a valid number
Long double uncertain 18 ~ 19 valid number

Inside double quotes directly output the contents of the inside, do not add double quotation marks the letters of the output are the letters before the number assigned,
The application of single quotation marks such as' A 'and cannot be written as "A"
'0' 0
Char ch='A'; Cout & lt; It is concluded that
A 65 165

Int (ch) said the ch character cast int
Sizeof function is used to obtain the length of the various data types, such as:
coutOutput 1
3.
constants and variables1. The constants: integer constants, real constants, character constants, symbolic constant
Const is a constant name
2. The variable
(1) the identifier cannot and the key words of the same name in the system, the system can't identify,
(2) the identifier can only include letters, Numbers, and underscore "_", and can only be letters or underscores in the beginning, such as sum123_
(3) the identifier must be defined first, after use,
(4) in the same scope, identifier cannot be repeated definition,
(5) identifiers are case sensitive
Variable assignment with=
Used to determine whether to use==output 1 or 0
4. Character and string
Character variables and strings
* if nothing within double quotes, known as the null character, and the double quotation marks with a space of the string is not the same,
1. The character variable
X hexadecimal problems
2. Escape symbol
Input the char a='a'; Putchar (a) outputs a
Extend the first input "\ " input "" output "\ " again said ""
3. The string variable
Hello six bytes in computer h e l l o \ 0
Getchar and putchar is a character input/output
5. The arithmetic operators
In the division/
5/2=2 5/2.0=5.0/2.0=2.5 2.5
Take over operation of
5=5=2, 7% - 7% - 2
Also is the result of plus or minus depending on % to the left of the number of plus or minus
Mathematical function before using these mathematical functions must add "cmath" or "math. H
"
# include
# include
using namespace std;
Int main () {

return 0;
}
Six cin statements,
Cout is output, cin is input,
Seven. Assignment statements,
Bool a, b. Judge whether the conclusion of the ab behind the output was founded, establishment output 1 is not 0,
(1) count composite,
A=a + a + x=x both equal, with certain what symbol
(2) the assignment operation,
Calculate the order from left to right, there is a bracket, first calculate the expression in brackets,
The comma operator priority below assignment priority,
Eight. Composite operator
1. The operator and the decrement operator
I++ or + + I
When used alone are equivalent to I=I + 1 minus and plus as
2. Composite arithmetic assignment +=-=, *=,
9. Operation rules,
Arithmetic operator direction for the combination of "first left after the right combination of some operator direction for" from right to left "assignment operator, for example,
Part of the operator precedence and associativity,

Casts,
(double) a type to convert a forced to double,
Ten. Prinrp function
Format control printp (" % d, % c \ n ", I, c) said it would variable I in integer output, variable c outputs in the form of characters, separated by a comma between two output items,
Format string control string is enclosed in double quotation marks, including two kinds: normal character, output, according to the sample by % and format characters, holds the output data into the format of the specified output,


2. The scanf function
(1) the keyboard "3, 4" is not "34"
(2) don't want to read characters can filter out


Feeling: more memory, more understanding, more utilization,



  • Related