上一页 1 ··· 52 53 54 55 56 57 58 59 60 ··· 62 下一页
摘要: 原型:extern char *strncat(char *dest,char *src,int n);   用法:#include <string.h>   功能:把src所指字符串的前n个字符添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。  说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。 返回指向dest的指针举例... 阅读全文
posted @ 2010-11-11 01:01 瓜蛋 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 将s所指向的某一块内存中的每个字节的内容全部设置为ch指定的ASCII值, 块的大小由第三个参数指定,这个函数通常为新申请的内存做初始化工作, 其返回值为指向S的指针。需要的头文件<memory.h> or <string.h>输出结果:   Buffer before memset: Hello world   Buffer after memset: *********... 阅读全文
posted @ 2010-11-11 00:59 瓜蛋 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int main(){ const char *str1="Hello"; cout<<str1[4]<<endl; return 0;} 阅读全文
posted @ 2010-11-08 01:20 瓜蛋 阅读(365) 评论(0) 推荐(0) 编辑
摘要: 零值比较--BOOL,int,float,指针变量与零值比较的if语句这是程序员面试的一道常见题,也是个C++基础问题。若只在大学里看过几本基础的编程入门书,看见这道题可能会觉得奇怪,不就是和0比较吗,直接拿出来比就是了,其实非也。下文引自google搜索结果,出处不详,高手可以无视,菜菜留下,记得... 阅读全文
posted @ 2010-11-08 00:45 瓜蛋 阅读(9789) 评论(1) 推荐(0) 编辑
摘要: 类的this指针有以下特点:(1)this只能在成员函数中使用。全局函数、静态函数都不能使用this.实际上,成员函数默认第一个参数为T * const this。如:class A{ public: int func(int p) { }};其中,func的原型在编译器看来应该是: int func(A * const this,int p);(2)由此可见,this在成员函数的开始前构造,在成... 阅读全文
posted @ 2010-11-05 20:05 瓜蛋 阅读(591) 评论(0) 推荐(1) 编辑
摘要: /*there are these several people: student teacher office_worker student_teacher*/#include <iostream>using namespace std;class people{public: people(const char*n) { name=new char[strlen(n)+1]; ... 阅读全文
posted @ 2010-11-05 02:18 瓜蛋 阅读(364) 评论(0) 推荐(0) 编辑
摘要: 以后晚上不再打游戏! 阅读全文
posted @ 2010-11-05 01:41 瓜蛋 阅读(161) 评论(0) 推荐(0) 编辑
摘要: CC++ 题集(CC++试题和部分答案)1. 以下三条输出语句分别输出什么?[C易] char str1[] = "abc"; char str2[] = "abc"; const char str3[] = "abc"; const char str4[] = "abc"; const char* str5 = "abc"; const char* str6 = "abc"; cout <... 阅读全文
posted @ 2010-11-04 23:15 瓜蛋 阅读(323) 评论(0) 推荐(0) 编辑
摘要: /************************************************************************//* 开发环境:vc6.0/* 时间:2010.10.31 by zhangdongsheng *//************************************************************************/#i... 阅读全文
posted @ 2010-11-02 00:48 瓜蛋 阅读(271) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <conio.h>/**//** * 秘密在于conio.h中的getch()从键盘中读取字符时,并不会在屏幕上输出已经输入的字符, * 而用一个putch('*')来哄骗,代表已经输入一个字符 * 怪不得这个头文件要叫conio.h, con的意思就有哄骗,看来就是由此而来. */using namespace st... 阅读全文
posted @ 2010-11-02 00:16 瓜蛋 阅读(2338) 评论(0) 推荐(0) 编辑
上一页 1 ··· 52 53 54 55 56 57 58 59 60 ··· 62 下一页