码迷,mamicode.com
首页 >  
搜索关键字:cout    ( 7219个结果
C++ 实现不能被继承的类
方法一:#include using namespace std;class A{public: static A* getInstance(); static void deleteInstance(A* pA);private: A() { cout using namespa...
分类:编程语言   时间:2014-08-19 12:17:24    阅读次数:203
c++模板的一些语法
模板的部分特化 template struct testClass { testClass(){cout<<"I,O"<<endl;} }; template struct testClass { testClass(){cout<<"T*,T*"<<endl;} }; 成员模板 template class v { public: template void in...
分类:编程语言   时间:2014-08-18 23:35:23    阅读次数:269
cout、cerr、clog有何区别?
windows+vs情况下:在控制台上,cout能重定向到文件,cerr和clog不能。输出重定向到文件实际上就是一个管道的一头连输出流,另一头连文件输入流 cout具有自己的缓冲区,当缓冲区满或遇到endl会刷新终端(默认是屏...
分类:其他好文   时间:2014-08-18 22:12:53    阅读次数:225
对于不同的平台,进行跨平台编程
使用if defined endif根据平台的不同 来加载使用不同的方法#if defined(WIN32) std::cout<<"win32"<<std::endl;#elif defined(POSIX) std::cout<<"posix"<<std::endl;#endif
分类:其他好文   时间:2014-08-18 15:53:52    阅读次数:150
cout操作符的递归
参考:http://bbs.csdn.net/topics/370021520下面输出结果是多少?#include using namespace std;int g=0;templateint foo(T a){static int value = ++g;cout(3)(false)(2.2f)...
分类:其他好文   时间:2014-08-18 15:49:12    阅读次数:168
ZOJ 1113
水题一道- -暴力做法、打表都可以0ms AC。时间:0毫秒。#include#includeusing namespace std;int main(){ double ans=1, temp=1; int i=0; cout<<"n e"<<endl; cout<<...
分类:其他好文   时间:2014-08-17 21:11:22    阅读次数:189
计算机内部整数的表示(二进制存储)
10、在16位机器上跑下列foo函数的结果是(B)(阿里2014笔试题)void foo(){int i = 65536;cout int main(){ __int16 a=65536; __int16 b=65535; __int16 c=65535+3; printf(...
分类:其他好文   时间:2014-08-17 16:43:52    阅读次数:219
注意sizeof()返回的数无符号数,有符号数遇到无符号数时变成无符号数
预测一下这道题的结果,注意unsigned与signed #include #include using namespace std; int arr[]={1,2,3,4,5}; int main(){ for(int i=-1;i<sizeof(arr)/sizeof(arr[0]) - 1;i++) cout<<arr[i+1]<<endl; } sizeof()返回的值是无符号数,...
分类:其他好文   时间:2014-08-17 15:38:02    阅读次数:251
关于string指针
string str("hello world");string *pstr = &str;cout << pstr[0] << endl;cout << *pstr << endl;本来以为psr[0]输出来的值是'h' 没有想到输出来的而是 hello world ,而且 *pstr输出的也是同...
分类:其他好文   时间:2014-08-17 15:32:32    阅读次数:336
足球赛售票
记忆式搜索#include using namespace std;int f(int a,int b){if(a>m>>n)cout<<f(m,n)<<endl;return 0;}
分类:其他好文   时间:2014-08-17 11:43:22    阅读次数:177
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!