自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(43)
  • 收藏
  • 关注

原创 聊天室服务器

#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>#include &...

2019-01-13 14:55:38 125

原创 const替换宏

#include using namespace std;// C++中的const修饰的是一个常量:// 1、const常量正常情况下内存不会为其分配空间,而是存在符号表中// 2、使用的时候去符号表中取值你// 3、如果对 const 常量进行取地址操作,则编译器会为其分配一块空间,但是 它本身并不会使用int main1(){const int a = 10; // 不能...

2019-01-12 09:14:13 350

原创 聊天室

#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>#include &...

2019-01-11 09:02:55 127

原创 聊天室

#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>#include &...

2019-01-09 20:58:54 93

原创 数据库

#include <stdio.h>#include <sqlite3.h>int main(){sqlite3 *db;int ret = sqlite3_open(“student.db”, &db );if (SQLITE_OK != ret){perror(“打开失败\n”);return -1;}const char *sql = "...

2019-01-04 14:02:41 86

原创 多进程tcp服务器

#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>#define P...

2019-01-02 20:23:15 214

原创 网络

2018-12-29 10:17:46 78

原创 生产者,消费费者模型2

#include <stdio.h>#include <semaphore.h>#include <pthread.h>#include <string.h>struct msg{char *buf[10]; // 缓冲区中的数据sem_t full; // 控制消费者进入sem_t empty; ...

2018-12-29 10:16:20 92

原创 消费者生产者模型

#include <stdio.h>#include <semaphore.h>#include <string.h>#include <pthread.h>struct data{ char *buf[10]; sem_t full;//控制消费者 sem_t empty;//控制生产者 int count;}data;p...

2018-12-28 08:59:02 68

原创 卖票模拟系统

#include <stdio.h>#include <semaphore.h>sem_t sem;int piao = 100;void maipiao(void *v){long num = (long)v;sem_wait(&sem);//p操作while (1){sleep(1);if (0 == piao){printf (“票卖...

2018-12-27 11:59:15 138

原创 c语言定时器

#include <stdio.h>#include <signal.h>#include <unistd.h>void handle_signal(int sigNum){ if (sigNum == SIGALRM) { printf ("hello\n"); alarm(2); // 重置定时时间 }}int mai...

2018-12-26 09:24:45 6334 1

原创 进程

#include <stdio.h>#include <sys/types.h>#include <unistd.h>int count = 0;int main1(){// 创建子进程// 返回值:1、在父进程中返回子进程的pid 2、在子进程中,返回0// 创建成功以后,子进程和父进程的执行顺序是不固定的pid_t pid = fork(...

2018-12-25 11:52:25 83

原创 读写文件

#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <errno.h>int main1(){// 第一个参数:要打开的文件名// 第二个参数:打开方式int fd = open(“man1.txt...

2018-12-21 20:42:08 72

原创 选择排序

#include <stdio.h>void myswap(int *a,int i,int j){ int temp = a[i]; a[i] = a[j]; a[j] = temp;}void mysort(int *a,int len){ int i; for (i = 1;i < len;i++) { int get = a[i]; in...

2018-12-19 19:57:31 53

原创 排序

冒泡#include <stdio.h>void myswap(int *a,int i,int j){ int temp = a[i]; a[i] = a[i+1]; a[i+1] = temp;}void mysort1(int *a,int len){ if (len == 1) return; int i; for (i = 0;i < ...

2018-12-18 21:00:16 73

原创 二叉树

#ifndef _BTREE_H_#define _BTREE_H_typedef enum {FLASS,TRUE} Bool;typedef enum {LEFT,RIGHT} Mountway;typedef char BtreeDate;typedef struct btreeNode{ BtreeDate data; struct btreeNode* lchi...

2018-12-18 08:58:30 79

原创 通讯录改版

#include <stdio.h>#include <stdlib.h>#include <string.h>typedef enum {FLASH,TRUE} Bool;typedef struct Data{ int id; char *name; long tel;}Data;typedef struct node{ Dat...

2018-12-15 18:52:42 128

原创 两种单链表的写法

#include <stdio.h>#include <stdlib.h>#include <string.h>typedef enum {FLASS,TRUE} Bool;typedef struct Data{ int id; char name[15];}Data;typedef struct Node{ struct Data...

2018-12-14 21:08:46 907

原创 停车场2

#include "park.h" #include <stdio.h> #include <time.h> int i = 0; void meau()//菜单 { printf("\t\t\t\t\t***********************************************...

2018-12-13 21:01:07 145

原创 停车场1

2018-12-12 20:58:49 247

原创 栈与队列

栈队列

2018-12-11 19:50:51 45

原创 单链表创建

#ifndef _LINKLIST_H_#define _LINKLIST_H_typedef enum{TRUE,FLASS,ERROR} Bool;typedef int Date;typedef struct _node{ Date date; struct _node* next; }Node;typedef struct _list{ Node *hea...

2018-12-10 09:39:33 130

原创 顺序表

头文件函数主函数

2018-12-10 09:28:18 59

原创 读书笔记

表1  c语言标准定义的32个关键字 关键字 意义 auto 声明自动变量,缺省时编译器一般默认为auto int 声明整型变量 double 声明双精度变量 long 声明长整型变量 ...

2018-12-05 20:13:26 65

原创 12.04

 

2018-12-05 09:08:57 66

原创 通讯录

 

2018-12-05 09:04:49 95

原创 作业12.01

23

2018-12-01 21:12:16 100

原创 贪吃蛇

2018-11-29 21:02:27 76

原创 Linuxc学习第十五天

  

2018-11-28 09:34:52 79

原创 linuxc学习第十四天

一    字符串处理函数

2018-11-26 20:57:58 70

原创 linux学习第十三天

2.某个公司采用公用电话传递数据信息,数据是小于8位的整数,为了确保安全,在传递过程中需要加密,加密规则如下:首先将数据倒序,然后将每位数字都加上5,再用和除以10的余数代替该数字,最后将第一位和最后一位数字交换。 请任意给定一个小于8位的整数,然后,把加密后的结果在控制台打印出来。             题目要求:        A:数据是小于8位的整数            ...

2018-11-24 20:23:27 84

原创 Linuxc学习第十二天

题目:一个数如果恰好等于它的因子之和,这个数被成为”完数”,例如:6=1+2+3.请编程找出1000以内的完数题目:编写程序,打印出9×9乘法表题目:编写程序,打印菱形星号组合     *    * *   *   *  *     *   *   *    * *     *题目: 输入一个字符串,计算字符串中子串出现的次字数题目:打印出所有的“水仙...

2018-11-23 20:23:11 77

原创 Linuxc学习第十一天

二维数组字符数组

2018-11-23 19:42:59 62

原创 linuxc第十天

题目:输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数。题目:输入一个整数a,再输入两个整数p1,p2(p1,p2<32),输出该整数的二进制表示方法中从右端开始的p1到p2位.题目:输入一个整数a,再输入两个整数p1,p2(p1,p2<32),将该整数的二进制表示方法中从右端开始的p1到p2位取反后输出题目:输入一个整数a,再输入两个整数p(p&...

2018-11-23 19:33:47 70

原创 linuxc学习第九天

函数(Function)是一段可以重复使用的代码,这是从整体上对函数的认识。       C语言本身带了很多库函数,并分门别类地放在了不同的头文件中,使用时只要引入对应的头文件即可。       除了C语言自带的函数,我们也可以编写自己的函数,称为自定义函数(User-Defined Function)。自定义函数和库函数没有本质的区别,表现形式和使用方法一样,只是开发者不同而已。 ...

2018-11-23 19:10:38 62

原创 linux学习第8天

2018-11-23 19:04:47 78

原创 linuxc第七天

在屏幕上显示cos(x)曲线与直线f(x)=45*(y-1)+31的叠加图形。其中cos(x)图形用*表示,f(x)用“”“+”表示,在两个图形的交点处则用f(x)图形的符号。2 在屏幕上绘制一个圆3   在屏幕上绘制y=x^2的曲线           2...

2018-11-18 15:01:16 63

原创 linuxc第六天

从1到N-1有一个值重复两次,找出重复值。如4,3,5,8,5,2,1,9,6,7中找出重复值为5。1.用两个数组,时间复杂度为O(n²)略。2.用两个数组,时间复杂度为O(n)。1 程序如下图2 ...

2018-11-18 14:38:32 63

原创 linux学习第五天

一    内存1.    程序中如何操作内存,用一个符号来代表某一段内存,那对这个符号的操作就是对这一段内存的操作。其中符号和内存空间我们叫做变量,符号和空间都是变量的一部分符号叫做变量名,空间叫做变量空间。2.    与人类做类比人本身               内存空间人名                   变量名身份证                变量编号(地址)(...

2018-11-16 11:10:33 95 1

原创 Linux学习第四天

一  gcc的使用1.计算机能识别的唯一语言是二进制语言语言的发展c语言是中级语言,具有汇编的特性,同时也具备高级语言可移植的特性。不管什么语言要想被计算机运行,必须转换成机器码。编译器:将源代码编译成可执行多的代码(程序),相同的代码经过不同的编译可以被不同的计算机所执行。2 Linux系统常用的编译c语言的编译器是:gccc语言程序的编译步骤gcc默认生成的...

2018-11-15 11:01:21 102

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除