![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C
cfchengfei002
这个作者很懒,什么都没留下…
展开
-
C++中变量定义在源文件中
在C++中,变量的定义应在.cpp源文件中,头文件中只可声明变量。 如果变量 int a ;定义在.cpp中,但在.h文件中用到了a;则在.h文件中声明extern int a; 如果一定要在.h文件中定义,则可以这样定义 inline int a; 原因:.h文件是不参与编译的,所以,如果在.h文件中定义了变量,那么在链接过程就会出错。 文件的标准命名法: C语言文原创 2012-03-06 23:12:48 · 899 阅读 · 0 评论 -
关于PHP自定义扩展加载的问题
最近项目需求,需要自己开发一个PHP扩展。在WIN32下载编译成功,可以在加载过程老是出问题。 自己疏忽没有看准问题所在,造成这个问题托了好几天: PHP Warning: PHP Startup: ****: Unable to initialize module Module compiled with build ID=API20090626,TS VC6 PHP com转载 2012-06-26 21:49:08 · 3021 阅读 · 0 评论 -
一些程序题(上机考)
1.找出一个数组中满足2^N的元素 #include using namespace std; int find(int a[],int len); void main() { int a[]={1,2,3,5,7,8,16}; int len=sizeof(a)/sizeof(int); cout } int find(int a[],int len) {转载 2012-09-13 12:33:45 · 1255 阅读 · 0 评论 -
统计一串字符串中出现次数最多和次多的单词(华为上机考试题)
//统计一串字符串中出现次数最多和次多的单词 #include #include #include int compare(const char * st1,const char * st2) { if (strcmp(st1,st2)==0) return 1; else return 0; } void PickWord(const char* p原创 2012-09-15 19:20:53 · 4115 阅读 · 2 评论 -
瑞晟笔试题
//判断大端小端 int checkEnd() { union { long a; char b }u; u.a = 1; if (u.b == 1) return 0; //小端,写在低端 else return 1; } //大端的高位写在低端,数字0102 ,地址0x01,0x02. 01存在0x01, 02存在0x02原创 2012-09-16 17:28:35 · 1409 阅读 · 0 评论 -
字符过滤(2013华为校园招聘上机考试)
一个字符串,如aAbas__a;要求,过滤为每个字符只出现一次:aAbs_; #include #include #include #include #include void chstr(const char *Input,char *Out) { int m=strlen(Input); const char *p=Input; char *q=Out;原创 2012-09-13 12:25:14 · 1887 阅读 · 0 评论 -
四则运算
#include #include #include #include #include #define STACK_SIZE 100 #define APPEND_SIZE 10 struct SNode{ float data; /*存放操作数或者计算结果*/ char ch; /*存放运算符*/ }; struct St转载 2012-10-10 11:28:26 · 513 阅读 · 0 评论