码迷,mamicode.com
首页 >  
搜索关键字:cout    ( 7219个结果
std::for_each
1 #include 2 3 #include 4 #include 5 #include 6 7 using std::vector; 8 using std::string; 9 using std::cout;10 using std::endl;11 12 template13...
分类:其他好文   时间:2014-09-12 23:28:34    阅读次数:203
reverse iterator
Problem 1:vector coll = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };vector::const_iterator pos = find (coll.cbegin(), coll.cend(),5);cout ::const_reverse_iterator r...
分类:其他好文   时间:2014-09-11 18:56:12    阅读次数:226
[C++]Reference to array as function parameter
templatevoid f(char (&arr)[N]){ std::cout << sizeof(arr) << '\n';}此时数组不会退化为指针(C++11 section 8.3.5.5)
分类:编程语言   时间:2014-09-11 16:40:42    阅读次数:224
Decode-译码
Decode-译码//Decode-译码 #include<iostream> #include<cstring> #include<cstdlib> #include<cctype> usingnamespacestd; voidprocess(stringstr,charch[],intkey); intmain() { stringstr; charch[100]; cout<<"Inputthecipher:\n"; cin&..
分类:其他好文   时间:2014-09-11 15:33:04    阅读次数:376
windows 64位整数
#include #include using namespace std;int main(){ cout << sizeof(long) << endl;//4 cout << sizeof(long long) << endl;//8 cout << sizeof(__int...
分类:Windows程序   时间:2014-09-10 23:45:41    阅读次数:286
改变const值的方式
一种改变const值的方式是使用const_cast类型转换符,将const变量转换为一个该变量的引用,通过这个引用去改变值,这种方法的实质就是用地址改变内存的值。如下实例:         struct SA {         int i = 0;      };        const SA sa;        cout        SA &sb =...
分类:其他好文   时间:2014-09-10 10:53:30    阅读次数:264
使用异或运算实现中两个变量互换的方法
按位异或运算可以在不引入临时变量的情况下实现两个变量值得互换。intmain() { inta=10; intb=12; cout<<"a="<<a<<";"<<"b="<<b<<endl; a=a^b;//异或运算 b=a^b; a=b^a; cout<<"a="<<a<<";"<<"b="<<b<..
分类:其他好文   时间:2014-09-10 02:56:41    阅读次数:186
取子集
#include #include #include using namespace std; void print(int n) { for(int i=0;(1<<i)<=n;i++) if(n&(1<<i)) cout<<1; else cout<<0; cout<<endl; } int main() { i...
分类:其他好文   时间:2014-09-09 16:03:59    阅读次数:220
C++中输出 位宽和小数点后位数 的控制
要用到这个头文件: setw(x) : 表示控制输出x的位宽 setprecision(x) :表示 控制输出小数点后 x 位 cout.precision(x): 表示控制输出的 该数值的5个数字 例如:y=1.0456789 cout.precision(3); cout#include us....
分类:编程语言   时间:2014-09-09 15:01:28    阅读次数:213
C/C++知识点
cout>键盘输入例子:double r=1.0;cin>>r; //键盘输入
分类:编程语言   时间:2014-09-09 12:24:18    阅读次数:164
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!