#include#include#include#include#include#include#include#include#include#include#includeusing
namespace std;const int inf=(int)1E9,maxT=100+1,maxn=20,...
分类:
其他好文 时间:
2014-05-08 19:16:07
阅读次数:
275
在JDK1.5 之前,我们定义常量都是: publicstaticfianl....
。现在好了,有了枚举,可以把相关的常量分组到一个枚举类型里,而且枚举提供了比常量更多的方法。Java代码 publicenumColor{
RED,GREEN,BLANK,YELLOW }public enum C...
分类:
编程语言 时间:
2014-05-08 19:12:44
阅读次数:
286
const关键字是C++中常用的类型修饰符,用法非常灵活,使用const将大大改善程序的健壮性。 const的作用 1. 定义const常量; 比如:
const int Max = 100; 2. 便于类型检查; const 常量有数据类型,而宏常量没有数据类型。 编译器对前者进行类型安全检查; ...
分类:
编程语言 时间:
2014-05-08 14:29:56
阅读次数:
351
1.在typedef中使用指针往往会带来意外的结果。如下:typedef string
*pstring;const pstring cstr;绝大数人刚开始都会认为cstr是一种指针,它指向const对象,即const pstring cstr
等价于const string *cstr,其实,这...
分类:
其他好文 时间:
2014-05-08 12:52:54
阅读次数:
319
#include#includeusing namespace std;int main(){
const int N=100; int const N=100; //二者等价 int mark=0; //1 int*
ref_mark=&mark; int* c...
分类:
其他好文 时间:
2014-05-08 10:02:04
阅读次数:
205
#include#includetemplateinline T const&
max(T const& a,T const &b){ //如果a<b,那么返回a return a<b?b:a;}int
main(){ int i=42; std::cout<<"max(7,...
分类:
其他好文 时间:
2014-05-08 09:50:44
阅读次数:
264
const是C++中的常量限定符,在编程中经常出现。本文介绍了用const修饰指针变量的三种用法,并介绍了它们之间的区别。...
分类:
其他好文 时间:
2014-05-07 23:07:16
阅读次数:
402
Explain的type显示的是访问类型,是较为重要的一个指标,结果值从好到坏依次是:system
> const > eq_ref > ref > fulltext > ref_or_null > index_merge
> unique_subquery > index_subquery > r...
分类:
其他好文 时间:
2014-05-07 21:26:56
阅读次数:
282
在C++中const变量定义时必须进行初始化,否则无法通过编译。初始化的方式有多种,可以通过字面值对其进行初始化,也可以通过变量对其初始化,或其他方式,只要能给const变量赋初值即可(当然初值应该有其意义)。例:int
i = -1;const int ic1 = -1;const int ic2...
分类:
其他好文 时间:
2014-05-07 20:27:15
阅读次数:
220