- 博客(8)
- 收藏
- 关注
原创 小米笔试题第1题
将字符串 "a" "my.ABC" "simple.HelloService" "MY.ASTParser123" 转换成宏: _A_ _MY_ABC_ _SIMPLE_HELLO_SERVICE_ _MY_AST_PARSER_123_ 代码如下: #include #include #include u
2017-09-20 19:53:10 515
原创 将两个有序链表融合成一个有序链表
已知两个有序链表,将两个有序链表融合成一个有序链表的实现方法: #include using namespace std; typedef struct _listNode { int data; struct _listNode *next; }listNode; void printList(listNode *plist) { if(plist == NULL) retur
2017-09-17 19:16:21 582
原创 求一个数组中前K大的数或者第K大的数
#include using namespace std; void BubbleSort(int a[], int alen) { for(int i = 0; i < alen; i++) { for(int j = alen-1; j > i; j--) { if(a[j] > a[j-1])
2017-09-16 14:53:12 2989
原创 C++程序学习--C++模板类重载左移操作符<<的细节
学习C++时,有时候我们会使用微软提供的VS软件,在学习到模板类重载左移操作符时会遇到一些问题,下面写一个简单的程序来举例: #include using namespace std; template class Complex { private: T a; public: Complex(T a); friend ostream & operator(ostream & os,
2016-11-25 16:47:17 1560
原创 C++程序学习--cin.get()函数读取空行时的细节
在学习《C++ Primer Plus》第六版第17章P780页的程序时遇到一个小问题,这个问题困扰了我很久,直到我找到了一篇博文http://www.cnblogs.com/tonglingliangyong/p/3908463.html,该问题是: 请看下面这个代码: #include #include using namespace std; int main() { char
2016-11-13 19:17:57 6554 4
原创 Linux学习日记--fork()函数笔记
以下内容是阅读了"蓝云"的博客后,博客地址:http://www.cnblogs.com/kunhu/p/3607376.html 随手做笔记: #include #include int main() { int i; pid_t pid; for(i = 0;i < 3; i++) {
2016-10-12 14:58:09 401
原创 Linux学习日记--简单Linux时间编程
#include time_t time(time_t *tloc) //获取日历时间 struct tm *localtime(const time_t *timep) //将日历时间转化为本地时间,并保存至tm结构 时间保存: struct tm { int tm_sec; /* 秒 – 取值区间为[0,59] */ int tm_min; /* 分
2016-10-11 18:13:35 383
原创 C程序学习日记--char字符串与整型、浮点型数据相互转换
char型字符串转换为整型的数,当然只能限定字符串存放的是'0'~'9'型的字符,一般使用atoi函数: #include int atoi(const char *nptr); //转换之后就是整型的数 而整型,浮点型的数转换为字符串时会有两种方法:一种是用函数实现,一种则是格式输出;函数实现的方法相对繁琐,可以用到itoa()函数,但是该函数不能被移植,而推荐另一种方
2016-10-09 14:01:30 1060
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人