上一页 1 ··· 8 9 10 11 12 13 14 15 下一页
摘要: 对于相同的函数名字,根据其输入的变量不同进行函数重载 /* 根据函数的输入变量不同进行函数重载 */ #include <iostream> using namespace std; void foo(int i) { cout << "int foo(int i)" << endl; } void 阅读全文
posted @ 2020-03-30 15:21 c语言我的最爱 阅读(1097) 评论(0) 推荐(0) 编辑
摘要: 这里使用or来替代||,使用<% 和 %>替代{} /* 操作字符 */ #include <iostream> using namespace std; int main() <% int a = 10, b = 0; if (a or b) <% cout << true << endl; %> 阅读全文
posted @ 2020-03-30 15:17 c语言我的最爱 阅读(1363) 评论(0) 推荐(0) 编辑
摘要: 字符串string 可以进行相加操作, s.size(), s.length(),s.c_str() 转换为c语言类型 /* 字符串演示 */ #include <iostream> #include <cstring> using namespace std; int main(void) { s 阅读全文
posted @ 2020-03-30 10:58 c语言我的最爱 阅读(1302) 评论(0) 推荐(0) 编辑
摘要: 使用struct定义结构体,使用Teacher t = {"", "", ""} 进行初始化操作 /* 结构体 */ #include <iostream> using namespace std; struct Teacher{ char name[20]; int age; double sal 阅读全文
posted @ 2020-03-30 10:56 c语言我的最爱 阅读(370) 评论(0) 推荐(0) 编辑
摘要: 使用namespace s1{} 定义s1的空间作用域,使用s1::func() 调用函数 /* 使用空间 */ #include <iostream> namespace s1{ void func(void) { std::cout << "这是s1的func函数" << std::endl; 阅读全文
posted @ 2020-03-30 10:09 c语言我的最爱 阅读(480) 评论(0) 推荐(0) 编辑
摘要: 使用二分法进行查找,通过中间位置的判断进行二分查找,将p_head 和 p_tail的位置进行改变,一直到p_head > p_tail 停止循环 /* 折半排序查找 */ #include <stdio.h> int half_search(int* p_val, int size, int va 阅读全文
posted @ 2020-03-29 21:04 c语言我的最爱 阅读(537) 评论(0) 推荐(0) 编辑
摘要: /* 排序算法 */ #include <stdio.h> //冒泡排序 void Bubble_sort(int *p_val, int size) { int j = 0; int i = 0; for (i = 0;i < size - 1;i++) { for (j = i;j < size 阅读全文
posted @ 2020-03-29 20:36 c语言我的最爱 阅读(799) 评论(0) 推荐(0) 编辑
摘要: 使用tree定义一个node指针地址,作为树块,node里面定义当前的val,左子树和右子树 02tree.h的定义 /* 二叉树 */ #include "02tree.h" void tree_init(tree *p_tree) { p_tree->p_node = NULL; //把方块里的 阅读全文
posted @ 2020-03-29 18:10 c语言我的最爱 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 双向链表,主要是构建了一个向前地址的指针p_prev,用于指向前面的指针地址 02link.h /* 构造链表的结构体 */ #ifndef __02LINK_H__ #define __02LINK_H__ #include <stdio.h> #include <stdlib.h> typede 阅读全文
posted @ 2020-03-29 16:36 c语言我的最爱 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 这里在定义链表的时候,使用node定义val和下一个数的地址 使用node head 和 node tail 定义初始值 01link.h /* 构造链表的结构体 */ #ifndef __01LINK_H__ #define __01LINK_H__ #include <stdio.h> #inc 阅读全文
posted @ 2020-03-29 16:15 c语言我的最爱 阅读(1075) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页