摘要: char * search(char *cpSource, char ch) { char *cpTemp=NULL, *cpDest=NULL; int iTemp, iCount=0; while(*cpSource) { if(*cpSource == ch) { iTemp = 0; cpT 阅读全文
posted @ 2020-08-21 20:49 Chilk 阅读(1182) 评论(0) 推荐(0) 编辑
摘要: 进制转换 #include <iostream> #include <vector> #include <string> using namespace std; string Convert(int num, int R) { string res; vector<int> temp; int r 阅读全文
posted @ 2020-08-21 19:32 Chilk 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #include <string.h> #include <stdio.h> #include <stdlib.h> class Light //电灯类 { public: void turnLight(int degree){ //调整灯光亮度,0表示关灯,100表示亮度最大 } }; class 阅读全文
posted @ 2020-08-21 15:26 Chilk 阅读(440) 评论(0) 推荐(0) 编辑
摘要: static 和 const关键字的作用 static 关键字至少有下列 n 个作用: 1. 函数体内static 变量的作用范围为该函数体,不同于 auto 变量,该变量的内存 只被分配一次,因此其值在下次调用时仍维持上次的值; 2. 在模块内的 static 全局变量可以被模块内所用函数访问,但 阅读全文
posted @ 2020-08-21 15:18 Chilk 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 面试之自定义字符串操作 strcpy #include <assert.h> char *strcpy(char *dest, const char *src) { assert( (dest != NULL) && (src != NULL); char *address = dest; whil 阅读全文
posted @ 2020-08-21 15:01 Chilk 阅读(111) 评论(0) 推荐(0) 编辑
摘要: ##C与C++中struct的区别 在c语言中,不能直接用结构体来声明变量,如果想在c语言中直接用结构体名定义变量,需要用到 typedef 在c++中,可以直接用结构体来声明变量 //c语言// //声明 struct stu { ... }; //定义 struct stu student; t 阅读全文
posted @ 2020-08-21 14:38 Chilk 阅读(260) 评论(0) 推荐(0) 编辑