class Solution {public: int
lengthOfLastWord(const char *s) { if (s == NULL) return 0; int mlen = 0, len =
0; bool inword = fa...
分类:
其他好文 时间:
2014-06-29 14:13:37
阅读次数:
229
time_t time(time_t
*t);如果t是空指针,直接返回当前时间。如果t不是空指针,返回当前时间的同时,将返回值赋予t指向的内存空间。函数: ctime功 能:
把日期和时间转换为字符串用 法: char *ctime(const time_t *time);#include#incl...
分类:
其他好文 时间:
2014-06-07 06:01:02
阅读次数:
169
Stack 一个简单确很有用的数据结构:FILOpackage Stackimport (
"errors" "fmt")const ( defaultLength=100)type Stack struct{ top int size int
element [...
分类:
其他好文 时间:
2014-06-07 05:14:42
阅读次数:
211
memcpy函数的功能是从源src所指的内存地址的起始位置开始拷贝n个字节到目标dest所指的内存地址的起始位置中,返回dest所指内存地址的起始位置。#include
#include #include void* Memcpy(void *dst, const void *src, size_t...
分类:
其他好文 时间:
2014-06-07 05:11:25
阅读次数:
221
memcpy() 的解释:void* memcpy(void* dst, const void*
src, size_t n);// if copying takes place between objects that overlap, the
behavior is undefined.因此自己...
分类:
其他好文 时间:
2014-06-07 04:35:21
阅读次数:
551
C++中的const关键字的使用方法很灵活,而使用const将大大改善程序的健壮性,本人依据各方面查到的资料进行总结例如以下,期望对朋友们有所帮助。Const
是C++中经常使用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。一、Const作用 例....
分类:
编程语言 时间:
2014-06-07 04:28:11
阅读次数:
369
1 #include 2 #include 3 using namespace std; 4
const int Max = 100000; 5 int num[Max]; 6 int find_[Max]; 7 bool found[Max]; 8
int pos[Max] = { 9 ...
分类:
其他好文 时间:
2014-06-07 03:49:29
阅读次数:
250
拷贝构造函数,是一种特殊的构造函数,它由编译器调用来完成一些基于同一类的其他对象的构建及初始化。其唯一的形参必须是引用,但并不限制为const,一般普遍的会加上const限制。此函数经常用在函数调用时用户定义类型的值传递及返回。拷贝构造函数要调用基类的拷贝构造函数和成员函数。如果可以的话,它将用常量...
分类:
其他好文 时间:
2014-05-29 00:01:47
阅读次数:
378
boolhandle(constosgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& aa){osgViewer::Viewer* viewer
=dynamic_cast(&aa);}bool ControlMan::handle(const o...
分类:
其他好文 时间:
2014-05-28 21:26:06
阅读次数:
670
1 #include 2 3 /*从一个图象文件中生成 GdkPixbuf 类型数据*/ 4
GdkPixbuf * create_pixbuf(const gchar *filename) 5 { 6 GdkPixbuf *pixbuf; 7
GError *error = ...
分类:
其他好文 时间:
2014-05-28 21:24:02
阅读次数:
289