#include <stdio.h> #include <stdlib.h> const int N=5; typedef struct student { long no; char name[20]; int score; }STU; void input(STU s[], int n); in ...
分类:
其他好文 时间:
2019-12-22 20:22:29
阅读次数:
96
// 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i ...
分类:
其他好文 时间:
2019-12-15 22:18:28
阅读次数:
106
字符串排序 题目 思路及流程图 1.定义数组用于储存str[5][80] 2.输入输入字符串 3.用选择排序将字符串从小到大排列 4.按题目格式输出 流程图: 核心代码 问题 1.scanf中把所读入的字符串传递给str[i]即可 2.排序时不能直接将一个数组赋值给另一个数组,要调用strcpy函数 ...
分类:
编程语言 时间:
2019-12-15 20:15:53
阅读次数:
123
20175325 实现mypwd(选做,加分) ================================ 一、题目内容: 1 学习pwd命令 2 研究pwd实现需要的系统调用(man k; grep),写出伪代码 3 实现mypwd 4 测试mypwd 二、步骤: 功能:查看”当前工作目录“ ...
分类:
其他好文 时间:
2019-12-15 14:46:13
阅读次数:
91
问题描述 完成一个目录复制命令mycp,包括目录下的文件和子目录, 运行结果如下: 思路 这道题目主要涉及文件读写操作和属性修改。需要支持文件夹复制、文件复制,在Linux下还要支持软链接的复制。 思路如下: 获取待复制目录的绝对路径 根据绝对路径进行dfs或者bfs搜索所有子目录项 判断子目录是属 ...
分类:
编程语言 时间:
2019-12-14 22:47:03
阅读次数:
117
目录 1 c ? strcpy ? strcat ? strlen ? strncat ? strncpy ? strcspn ? strdup ? stricmp ? strerror ? strcmp strcpy 原型:extern char *strcpy(char *dest,char * ...
分类:
其他好文 时间:
2019-12-07 12:36:32
阅读次数:
104
strcmp:C++自带函数 字典序 strcpy:交换顺序 getline: 本质上有两种getline函数,一种在头文件中,是istream类的成员函数。一种在头文件中,是普通函数。 在中的getline函数有两种重载形式: 作用是从istream中读取至多n个字符保存在s对应的数组中。即使还没 ...
分类:
其他好文 时间:
2019-12-07 12:09:31
阅读次数:
87
题意: 思路: 先建好整棵树。 遇到+val操作用dfn对区间+val 遇到加新点清空一下该点的点值(这里保证了之后查询的点肯定是清空过的) 差分+树状数组or线段树 1 #define IOS ios_base::sync_with_stdio(0); cin.tie(0); 2 #include ...
分类:
其他好文 时间:
2019-11-28 21:16:02
阅读次数:
92
log.c: #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> #include <time.h> #include <unistd.h> #inclu ...
分类:
其他好文 时间:
2019-11-27 12:15:39
阅读次数:
85
1.标准strcat 会有溢出风险,sdscat无溢出风险 2.空间预分配,惰性空间释放 空间预分配:sds分配空间时,如果原来是5,free是0, sdscat追加一个10长度的,此时字符串加长到15,free也同时分配15,总长为15 + 15free + 1(/0) 为31字节; 若大于1M后 ...
分类:
其他好文 时间:
2019-11-26 09:32:13
阅读次数:
89