1, auto Let the compiler determine the type automatically, typeID return type, displacement operation
The source code is as follows:
//consoleapplication1.cpp: defines the entry point for the console application.
//
#include "StdAfx.h"
#include <iostream>
using std::cout;
using Std::endl;
using std::cin;
int Main ()
{
//auto automatic judgment type, typeid function return type
int x = 5000;
int y = 20;
Auto z1=x/y;
Auto z2=y/x;
Char temp;
cout << typeid(z1). Name ()<< Endl;
cout << typeid(Z2). Name ()<< Endl;
// bit arithmetic
int x1 = 0x0001;
int x2 = 0x0008;
int x3 = 0x0005;
int x4 = 0x000A;
int z3 = x1|x2; // or
int z4 = x1&x2; // with the
int z5 = x1|x3; // or
int Z6 = x1^x4; // XOR or
int Z7 = x2 >> 2; // Move right 2 bits, except 2^2
int Z8 = Z7 << 1; // Move left 1 bits, multiply by 2
cout << z3<<"<<Z4<<"<< Z5<<"<<z6<< " "<<Z7 << " " <<Z8<<Endl;
CIN >> temp;
return 0;
}
This blog all content is original, if reprint please indicate source http://blog.csdn.net/myhaspl/
The results are as follows:
Int
Int
9 0 5) 11 24
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Win Programming Practice (2) "C + +"