自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(30)
  • 资源 (1)
  • 收藏
  • 关注

原创 线程的编程练习

#include #include #include int flag = 1;void * thread_function(void * arg);int main(){ int ret; pthread_t tid; void * thread_result; int count = 1; ret = pthread_create(&tid,NULL,thr

2016-11-30 14:55:19 169

原创 线程的编程练习

#include #include #include #include struct menber{ int a; char *s;};void *create(void *arg){ struct menber *temp; temp=(struct menber *)arg; printf("menber->a = %d \n",t

2016-11-29 21:52:01 197

原创 线程的编程练习

#include #include #include /*getpid()*/void *create(void *arg){ printf("New thread .... \n"); printf("This thread's id is %u \n", (unsigned int)pthread_self()); printf("The process

2016-11-28 16:36:49 159

原创 共享内存的编程练习

#include #include #include #include #include #include #define BUFFER_SIZE 2048int main(){ pid_t pid; int shmid; char *shm_addr; char flag[]="parent"; char buff[BUFFER_SIZ

2016-11-27 21:37:23 262

原创 简单的格式化输入输出练习

#include int main(){ int i = 0; int num; short s_num; long l_num; char ch; float f_num; double d_num; char *ptr; char src[100]; int a[3]; printf("input num:\n"); scanf("%d",&n

2016-11-26 23:07:55 352

原创 编程练习题

编写fun函数,主函数写入一个N*N的数组,fun函数能够求出其周边的平均值并返回。#include #include #include #define N 5double fun(int a[][N]){ int i; int j; int sum1 = 0,sum2 = 0; int sumrow = 0; int sumcolumn = 0; int su

2016-11-25 19:07:29 213

原创 编程练习题

编写fun函数,实现一个N*N的数组的右上半乘以随机数m,并输出。#include #include #include #define N 10typedef struct ss{ char name[10]; int s;}STU;fun (STU a[],STU *s){ int i; *s = a[0]; for(i = 0;i < 4;i++)

2016-11-24 18:16:05 224

原创 编程练习题

编写fun函数,利用结构体输入学生的姓名和成绩,调用fun函数,输出成绩最低学生的姓名和成绩#include #include #include #define N 10typedef struct ss{ char name[10]; int s;}STU;fun (STU a[],STU *s){ int i; *s = a[0]; for(i = 0

2016-11-23 16:03:46 226

原创 二级基础编程练习

计算一个字符串中单词个数,单词由空格隔开#include #include #define N 1024int main(){ char s[N]; int count = 0; int i = 0; printf("please enter a string:\n"); gets(s); for(i = 0;s[i] != '\0';i++) { if

2016-11-22 19:13:50 195

原创 有名管道应用(返回字符串)

#include #include #include #include #include #include #include #define FIFO_SEVER "/tmp/fifosever"int main(int argc,char *argv[]){ int fd; char w_buf[4096*2]; int real_wnum;

2016-11-21 15:34:20 200

原创 有名管道应用(返回字符串)

#include #include #include #include #include #include #include #define FIFO "./myfifo"main(int argc,char** argv){ char buf_r[100]; int fd; int nread; /* 创建管道 */ if((

2016-11-20 21:33:12 211

原创 文件练习题

有5个学生,每个学生有3门课的成绩,从键盘输入数据(包括学生号,姓名,3门课的成绩),计算出平均成绩,将原有数据和计算出的平均分数存放在磁盘文件stud中。#include #include #include #define N 1024struct student{ char name[N]; int num; int score[N]; float ave;}

2016-11-19 17:16:31 257

原创 文件练习题

从键盘输入一个字符串,将其中的小写字母全部转换成大写字母,然后输出到一个磁盘文件test中保存。输入的字符串以!结束。#include #include #include #define MAX_SIZE 1024int main(){ char str[MAX_SIZE]; FILE *fp; int i = 0; printf("please enter a

2016-11-18 20:59:11 299

原创 通讯录(文件版)

#include #include #include #define N 1024struct node{ int num ; char name[N]; char telephone[N]; char address[N]; struct node * next;};typedef struct node Node;typedef struct node * Lin

2016-11-17 15:28:06 266

原创 通讯录(数据库版)

#include #include #include #include #define N 1024void menu(){ printf("**********欢迎使用通讯录**********\n"); printf("* *\n"); printf("*1.

2016-11-16 21:16:20 403

原创 文件操作练习

去除文件1中以及2中的首行与末行,其余的进行相加,结果保存在3文件中,格式相同。#include #include int main(){ FILE *fp1,*fp2,*fp3; char ch1,ch2,ch3; int sum1 = 0,sum2 = 0,sum = 0; int i3; int flag = 1; if((fp1 = fopen("a1.tx

2016-11-15 22:44:47 269

原创 通讯录程序(链表版)

#include #include #include #define N 1024struct node{ int num ; char name[N]; char telephone[N]; char address[N]; struct node * next;};typedef struct node Node;typedef struct node * Lin

2016-11-14 21:33:28 371

原创 数据库练习

数据库文件的读写等操作#include #include #include int creat_table(sqlite3 *db){ char *errmsg = NULL; char *sql; sql = "create table if not exists student(id integer,name text);"; if(SQLITE_OK != s

2016-11-13 22:11:24 203

原创 编程练习题

程序STUDENT *Create(STUDENT studs[],int n)。STUDENT是一个结构类型,包含姓名、成绩和指针域。studs数组中存储了n个STUDENT记录。create函数的功能是编写根据studs数组建立一个链表,链表中结点按成绩降序排列,函数返回链表头指针。#include#includetypedef struct student{ char name

2016-11-12 21:27:38 245

原创 Linux系统命令及其详解4

名称: lpd   使用权限: 所有使用者  使用方式:lpd [-l] [#port] lpd 是一个常驻的印表机管理程式,它会根据/etc/printcap 的内容来管理本地或远端的印表机。/etc/printcap中定义的每一个印表机必须在 /var/lpd中有一个相对应的目录,目录中以cf 开头的档案表示一个等待送到适当装置的印表工作。这个档案通常是由lpr

2016-11-11 20:15:17 215

原创 Linux系统命令及其详解3

名称:kill   使用权限:所有使用者   使用方式: kill [ -s signal | -p ] [ -a ] pid ... kill -l [ signal ]   说明:kill 送出一个特定的信号(signal) 给行程id 为pid 的行程根据该信号而做特定的动作,若没有指定,预设是送出终止 (TERM)的信号   把计: -s

2016-11-10 13:43:40 398

原创 Linux系统命令及其详解2

名称:at   使用权限:所有使用者   使用方式:at -V [-q queue] [-f file] [-mldbv] TIME  说明:at 可以让使用者指定在TIME 这个特定时刻执行某个程式或指令,TIME的格式是 HH:MM其中的HH 为小时,MM为分钟,甚至你也可以指定am, pm, midnight, noon, teatime(就是下午

2016-11-09 22:07:17 298

原创 Linux系统命令及其详解1

cat cd chmod chown cp cut名称:cat   使用权限:所有使用者   使用方式:cat [-AbeEnstTuv] [--help] [--version] fileName  说明:把档案串连接后传到基本输出(萤幕或加 > fileName 到另一个档案)   参数: -n 或 --number由 1开始对所有输出的行数编号

2016-11-08 19:21:47 195

原创 编程练习题

一、 编写程序STUDENT *Create(STUDENT studs[],int n)。STUDENT是一个结构类型,包含姓名、成绩和指针域。studs数组中存储了n个STUDENT记录。create函数的功能是根据studs数组建立一个链表,链表中结点按成绩降序排列,函数返回链表头指针。#include#includetypedef struct student{ char n

2016-11-07 16:12:08 295

原创 编程规范

¹ 7-1:在同一项目组或产品组内,要有一套统一的为集成测试与系统联调准备的调测开关及相应打印函数,并且要有详细的说明。说明:本规则是针对项目组或产品组的。¹ 7-2:在同一项目组或产品组内,调测打印出的信息串的格式要有统一的形式。信息串中至少要有所在模块名(或源文件名)及行号。说明:统一的调测信息格式便于集成测试。¹ 7-3:编程的同时要为单元测试选择恰当的测试点,并仔细构造测试

2016-11-06 20:48:25 189

原创 编程规范

¹ 6-1:对所调用函数的错误返回码要仔细、全面地处理。¹ 6-2:明确函数功能,精确(而不是近似)地实现函数设计。¹ 6-3:编写可重入函数时,应注意局部变量的使用(如编写C/C++语言的可重入函数时,应使用auto即缺省态局部变量或寄存器变量)。说明:编写C/C++语言的可重入函数时,不应使用static局部变量,否则必须经过特殊处理,才能使函数具有可重入性。¹ 6-4:编写可

2016-11-05 22:00:16 225

原创 编程规范

¹ 5-1:去掉没必要的公共变量。说明:公共变量是增大模块间耦合的原因之一,故应减少没必要的公共变量以降低模块间的耦合度。¹ 5-2:仔细定义并明确公共变量的含义、作用、取值范围及公共变量间的关系。说明:在对变量声明的同时,应对其含义、作用及取值范围进行注释说明,同时若有必要还应说明与其它变量的关系。¹ 5-3:明确公共变量与操作此公共变量的函数或过程的关系,如访问、修改及创建等。

2016-11-04 20:34:36 166

原创 复杂的c/c++声明

int n;  这个应该被理解为“declare n as an int”(n是一个int型的变量)。  接下去来看一下指针变量,如下:  int *p;  这个应该被理解为“declare p as an int *”(p是一个int *型的变量),或者说p是一个指向一个int型变量的指针。我想在这里展开讨论一下:我觉得在声明一个指针(或引用)类型

2016-11-03 15:28:15 201

原创 编程规范

¹ 4-1:注意运算符的优先级,并用括号明确表达式的操作顺序,避免使用默认优先级。说明:防止阅读程序时产生误解,防止因默认的优先级与设计思想不符而导致程序出错。示例:下列语句中的表达式word = (high if ((a | b) && (a & c))      (2)if ((a | b) 如果书写为high a | b && a & ca | b 由

2016-11-02 20:11:55 170

原创 结构体

结构的定义定义一个结构的一般形式为:struct 结构名{成员表列}成员表由若干个成员组成,每个成员都是该结构的一个组成部分。对每个成员也必须作类型说明。例如:struct stu{int num;char name[20];int age;}结构类型变量的说明结构体定义并不是定义一个变量,而是定义了一种数据类型,这种类型是你定义的,

2016-11-01 21:06:09 145

C++ 发送http 请求

C++ 发送http 请求

2020-12-29

空空如也

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

TA关注的人

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