C(++)入门

C (++) programming

Output

单字符:

putchar('char')

cout << 'char';
cout << '\'';

多字符:

printf("str");

cout << "str";

格式化输出:

"%d", int
"1.6f%", float   ---'1'表示至少1 Byte

cout << "str" << int << endl

Comments:

//  行
/**/ 块

变量(variable type):

* int        --4 Bytes(常量同)
* float      --8 Bytes
* bool       --1 Bit
* double     --   
* char       --1 Byte
* 

evaluation:

var = var2;  
var = value; //此表达式返回变量值
var = ++ var3;

initialization

int b = 0;

type conversion

int --> char  ----丢掉高位字节
char --> int  ----先赋低位字节,如果低位字节的最高位是0,前面都补0;是1,则补1
10000000 --> -128
01111111 --> 127
-(n+1) == ~n --->'~'取反符号,即每个bit 0 -> 1, 1 -> 0.




bool isMale = 100;     ---- isMale == 1
hexadecimal
octonary
binary

input


你可能感兴趣的:(技术博客)