码迷,mamicode.com
首页 >  
搜索关键字:提升cin cout    ( 7220个结果
C/C++中各种类型int、long、double、char表示范围(最大最小值)
#include#include#include using namespace std;int main(){ cout ::max)(); cout ::min)() ::max)(); cout ::min)() ::max)(); cout ::min)() ::ma...
分类:编程语言   时间:2014-10-18 19:39:49    阅读次数:307
VC网络连接判断API
bool isConnect; DWORD dw; isConnect = ::IsNetworkAlive(&dw);if(isConnect) cout << "IsNetworkAlive连接" <<endl; else cout << "IsNetworkAlive未连接"...
分类:Windows程序   时间:2014-10-18 16:42:36    阅读次数:170
插入排序
复习一下原来学习的排序算法。 #include using namespace std; void print(int *a,int n) { for(int i=0;i<n; ++i) { cout<<a[i]<<' '; } cout<<endl; } void InsertSort(int *a,int n) { int i,...
分类:编程语言   时间:2014-10-18 15:33:11    阅读次数:146
int?(*p)[4]?p?是二级指针?二维数组?二级指针?.xml
试验一:inta[3][4]={1,2,3,4,5,6,7,8,9,10,11,12};int(*p)[4];for(p=&a[0];p<&a[0]+3;p++)cout<<&p<<endl;0012FF400012FF400012FF40for(p=&a[0];p<&a[0]+3;p++)cout...
分类:编程语言   时间:2014-10-17 23:15:40    阅读次数:325
小数点输出精度控制问题?.xml
setf()是追加标志字的函数,而flags()是设置标志字fixed标志是以定点形式显示浮点数当有fixed标志时,说明数据按一定的位数输出,否则去掉fixed标志后,数据按原位输出---即小数最后面的0不显示因此,使用时有两种情况:(1)原位输出,这时应去掉fixed标志:cout。unsetf...
分类:其他好文   时间:2014-10-17 23:14:40    阅读次数:247
C++11之function模板和bind函数适配器
在C++98中,可以使用函数指针,调用函数,可以参考之前的一篇文章:类的成员函数指针和mem_fun适配器的用法。 简单的函数调用 对于函数: void foo(const string &s) { cout f = &foo; f("bar"); 再看另外一个例子: void foo(int i,...
分类:编程语言   时间:2014-10-17 23:11:50    阅读次数:367
设计模式(二)
模板方法模式    GOOD:把不变的代码部分都转移到父类中,将可变的代码用virtual留到子类重写 #include #include #include using namespacestd;   classAbstractClass { public:        void Show()        {               cout我是"      ...
分类:其他好文   时间:2014-10-16 18:48:03    阅读次数:198
C++默认参数(转)
函数的默认参数值,即在定义参数的时候同时给它一个初始值。在调用函数的时候,我们可以省略含有默认值的参数。也就是说,如果用户指定了参数值,则使用用户指定的值,否则使用默认参数的值。void Func(int i = 1, float f = 2.0f, double d = 3.0){ cout...
分类:编程语言   时间:2014-10-16 17:36:52    阅读次数:171
关于虚析构函数的作用和使用
作用:作为基类使用的类应该具有虚析构函数,以保证在删除基类指针(动态分配的对象)时,根据指针实际指向的对象进行适当的析构。 请看下面这段代码; #include class A{ public: A(){ std::cout << "A constructor execute" << std::endl; } ~A(){ std::cout << "A destructor...
分类:其他好文   时间:2014-10-15 16:11:41    阅读次数:195
C++-传值与传引用的区别
//值传递与引用传递的区别 #include #include using namespace std; void fiddle(int in1, int &in2) { in1 = in1 + 100; in2 = in2 + 100; cout << "The values are "; cout << setw(5) << in1; cout << setw(5) << i...
分类:编程语言   时间:2014-10-15 15:50:11    阅读次数:219
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!