随笔分类 - HomeWork
摘要:第二章 题目1 5.试分别构造一个UNIX/Linux与Windows环境下循环UDP服务器例程,要求该服务器例程能够反复读取来自客户的任何请求,且一旦客户的请求中包含"time"字段,则该服务器例程将计算服务器的当前时间,并将该时间值作为响应返回给发送请求的客户。(发送close,服务器断开连接)
阅读全文
摘要:ftp服务器 客户端 #include<stdio.h> #include<stdlib.h> #include<string.h> #include<errno.h> #include<sys/socket.h> #include<arpa/inet.h> #include<netinet/in.
阅读全文
摘要:第一章 主机序与网络序转换函数 #include<netinet/in.h>uint32_t htonl(uint32_t hosttolong);uint32_t ntohl(uint32_t nettohostlong);uint16_t htons(uint16_t hosttoshort);
阅读全文
摘要:编程实现创建2个新进程,每个新进程负责打印出: (1)“Hello!My father is+父进程号” (2)“I am +子进程号” (3)50以内的质数 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <s
阅读全文
摘要:循环服务器TCP|UDP客户端与服务器流程 Linux: Windows:
阅读全文
摘要:USB接口、串口、并口区别 转载自:http://www.elecfans.com/yuanqijian/jiekou/20180326652497_a.html USB接口介绍 通用串行总线(英语:UniversalSerialBus,缩写:USB)是连接计算机系统与外部设备的一种串口总线标准,也
阅读全文
摘要:数据库DDL、DCL、DML语句 DDL,Data Definition Language,数据库定义语言 用于定义和管理数据库所有对象的语言 包括:CREATE,ALERT,DROP,TRUNCATE DML,Data Manipulation Language,数据库操作语言 SQL中处理数据等
阅读全文
摘要:Ships Puzzle - Solution The Puzzle: There are 5 ships in a port:1. The Greek ship leaves at six and carries coffee.2. The Ship in the middle has a bla
阅读全文
摘要:客户端发送文件名给服务器,服务器接受文件名,将对应的文件发送给客户端 基于TCP的Linux文件传输 客户端: #include <stdio.h> #include <sys/socket.h> #include <string.h> #include <arpa/inet.h> #include
阅读全文
摘要:基于UDP的Windows通信 客户端: #include <stdio.h> #include <WinSock2.h> #pragma comment(lib, "ws2_32.lib") #define SERVERIP "127.0.0.1" #define SERVER_PORT 2333
阅读全文
摘要:[基本要求] 假设人名为中国人姓名的汉语拼音形式。待填入哈希表的人名共有30个,取平均查找长度的上限为2。哈希函数用除留余数法构造,用线性探测再散列法或链地址法处理冲突。 [测试数据] 取周围较熟悉的30 个人名 #include<iostream> #include<string> #define
阅读全文
摘要:期末了,赶紧复习一波,手打一份书上的代码以便随时查阅 第二章: //顺序表存储结构 #define MAXSIZE 100 typedef struct { Elemtype *elemt; int length; }Sqlist; Status InitList(Sqlist &L) { L.el
阅读全文
摘要:哈夫曼树,第一行输入一个数n,表示叶结点的个数。 需要用这些叶结点生成哈夫曼树,根据哈夫曼树的概念,这些结点有权值,即weight,题目需要输出哈夫曼树的带权路径长度(WPL)。 输入格式: 第一行输入一个数n,第二行输入n个叶结点(叶结点权值不超过1000,2<=n<=1000)。 输出格式: 在
阅读全文
摘要:PS:所有的代码示例使用的都是这个图 2019-10-29 利用p126的算法5.3建立二叉树,并完成三种遍历算法 中序 后序 先序 #include<iostream> #include<stack> #define TElemType char using namespace std; type
阅读全文
摘要://二叉树的顺序存储表示 #define MAXTSIZE 100 typedef TElemtype SqBiTree[MAXTSIZE]; SqBiTree bt; //二叉树的二叉链表存储表示 typedef struct BiTNode { TElemType data; struct Bi
阅读全文