2008年2月19日

2008年2月编程语言排名

摘要: 阅读全文

posted @ 2008-02-19 10:30 浴盆 阅读(3058) 评论(7) 推荐(0) 编辑

2008年2月7日

C++中关于sizeof的相关应用

摘要: #include<iostream>usingnamespacestd;intmain(){intarry[3]={1};cout<<"sizeof(array)"<<"="<<sizeof(arry)<<endl;cout<<"sizeof(arry[0])"<<"="<<sizeof(arry[0]... 阅读全文

posted @ 2008-02-07 16:12 浴盆 阅读(394) 评论(3) 推荐(0) 编辑

2008年2月3日

用泛型实现在数组模拟入栈出栈时多类型的使用

摘要: /**//**CreatedbySharpDevelop.*User:??*Date:2008-2-3*Time:9:14**??????*/usingSystem;classStatck<T>{privateT[]statck;privateintcount;publicStatck(intsize){statck=newT[size];count=0;}publicvoidPush... 阅读全文

posted @ 2008-02-03 10:54 浴盆 阅读(397) 评论(2) 推荐(0) 编辑

2008年2月1日

C++中几种不同交换两个数的方法

摘要: #include<iostream>usingnamespacestd;voidswapr(int&a,int&b);voidswapp(int*a,int*b);voidswapv(inta,intb);intmain(){inta,b;cout<<"请输入a"<<endl;cin>>a;cout<<"请输入b"<... 阅读全文

posted @ 2008-02-01 13:22 浴盆 阅读(2224) 评论(0) 推荐(0) 编辑

C++中引用变量的用例

摘要: #include<iostream>usingnamespacestd;intmain(){inti=1;int&x=i;//对变量I的引用cout<<"i="<<i<<""<<"address="<<&i<<endl;cout<<"x="<<x<<""<&... 阅读全文

posted @ 2008-02-01 12:54 浴盆 阅读(458) 评论(0) 推荐(0) 编辑

关于strlen/sizeof函数在char和string类型中的应用

摘要: #include<iostream>usingnamespacestd;intmain(){//typedefstructstudent//{//charname[10];//charsex;//longsno;//floatscore[4];//}STU;////STUa[5];////cout<<sizeof(a)<<endl;////return0;cha... 阅读全文

posted @ 2008-02-01 10:01 浴盆 阅读(962) 评论(0) 推荐(0) 编辑

2008年1月31日

常用路由协议

摘要: RIP/OSPF/IGRP/BGP 阅读全文

posted @ 2008-01-31 21:24 浴盆 阅读(372) 评论(0) 推荐(0) 编辑

关于内存泄露

摘要: 内存泄漏可以分为4类: 1. 常发性内存泄漏。发生内存泄漏的代码会被多次执行到,每次被执行的时候都会导致一块内存泄漏。 2. 偶发性内存泄漏。发生内存泄漏的代码只有在某些特定环境或操作过程下才会发生。常发性和偶发性是相对的。对于特定的环境,偶发性的也许就变成了常发性的。所以测试环境和测试方法对检测内存泄漏至关重要。 3. 一次性内存泄漏。发生内存泄漏的代码只会被执行一次,或者由于算法上的缺陷,导致... 阅读全文

posted @ 2008-01-31 21:19 浴盆 阅读(536) 评论(0) 推荐(0) 编辑

不使用第三个变量交换两个变量

摘要: #include<iostream>usingnamespacestd;intmain(){inta,b;cin>>a;cin>>b;cout<<"交换前"<<endl;cout<<"a="<<a<<endl;cout<<"b="<<b<<endl;a=a+b;b=a... 阅读全文

posted @ 2008-01-31 20:34 浴盆 阅读(590) 评论(7) 推荐(0) 编辑

struct和union的大小问题

摘要: union类型以其中size最大的为其大小struct类型以其中所有size大小之和为其大小#include<iostream>usingnamespacestd;intmain(){typedefunion{longi;intk[5];charc;}DATE;structdata{intcat;DATEcow;doubledog;}too;DATEmax;cout<<"s... 阅读全文

posted @ 2008-01-31 17:42 浴盆 阅读(1394) 评论(0) 推荐(0) 编辑

导航