当前位置: 首页 > news >正文

襄阳市做网站 优帮云网站建站费用多少钱

襄阳市做网站 优帮云,网站建站费用多少钱,建企业网站多少钱,自己做网站如何月入3k关于单链表的详细了解请见博主的另一篇博客#xff0c;本文旨在对单链表进行应用#xff0c;采用C语言编写。 http://t.csdnimg.cn/iBpFa 一、驱动层 1.1 SList.h #pragma once#includestdio.h #includestdlib.h #includeassert.h #include本文旨在对单链表进行应用采用C语言编写。 http://t.csdnimg.cn/iBpFa 一、驱动层 1.1 SList.h #pragma once#includestdio.h #includestdlib.h #includeassert.h #includeContact.h #includestring.htypedef peoInfo SLTDataType;typedef struct SlistNode {SLTDataType data;struct SlistNode* next; }SLTNode;//链表销毁 void SLTDestory(SLTNode** pphead);// 尾插 void SLTPushBack(SLTNode** pphead, SLTDataType x); // 头删 void SLTPopFront(SLTNode** pphead);// 删除指定位置的节点 void SLTDelete(SLTNode** pphead, SLTNode* pos); 1.2 SList.c #includeSList.h//为避免重复无意义的操作封装函数实现 SLTNode* SLTBuyNode(SLTDataType x) {SLTNode* newnode (SLTNode*)malloc(sizeof(SLTNode));if (newnode NULL){perror(malloc);exit(1);}newnode-data x;newnode-next NULL;return newnode; } // 尾插 void SLTPushBack(SLTNode** pphead, SLTDataType x) {assert(pphead);SLTNode* newnode SLTBuyNode(x);//判断是否为空节点if (*pphead NULL){*pphead newnode;}else{//找尾节点SLTNode* ptail *pphead;while (ptail-next){ptail ptail-next;}ptail-next newnode;}} //头删 void SLTPopFront(SLTNode** pphead) {assert(pphead);assert(*pphead);//链表只有一个节点if ((*pphead)-next NULL){free(*pphead);*pphead NULL;}else{SLTNode* phead *pphead;*pphead (*pphead)-next;free(phead);} } // 删除指定位置的节点 void SLTDelete(SLTNode** pphead, SLTNode* pos) {assert(pphead *pphead);assert(pos);SLTNode* prev *pphead;if (*pphead pos) //如果是头节点{SLTPopFront(pphead);}else{//寻找前一个节点while (prev-next ! pos){prev prev-next;}prev-next pos-next;free(pos);pos NULL;}} //链表销毁 void SLTDestory(SLTNode** pphead) {assert(pphead);SLTNode* pcur *pphead;while (pcur){SLTNode* temp pcur-next;free(pcur);pcur temp;}*pphead NULL; } 二、调用层 2.1 Contact.h #pragma once #define NAME_MAX 100 #define SEX_MAX 4 #define TEL_MAX 11 #define ADDR_MAX 100//用户数据 typedef struct PersonInfo {char name[NAME_MAX];char sex[SEX_MAX];int age;char tel[TEL_MAX];char addr[ADDR_MAX]; }peoInfo;typedef struct SlistNode Contact;//添加通讯录数据 void ContactAdd(Contact** con); //删除通讯录数据 void ContactDel(Contact** con); //展示通讯录数据 void ContactShow(Contact* con); //查找通讯录数据 void ContactFind(Contact* con); //修改通讯录数据 void ContactModify(Contact** con); //销毁通讯录数据 void ContactDestroy(Contact** con); 2.2 Contact.c #define _CRT_SECURE_NO_WARNINGS 1 #includeSList.h #includestring.hContact* FindByname(Contact* con, char* cmp) {Contact* pcur con;while (pcur){if (strcmp(pcur-data.name,cmp) 0){return pcur;break;}pcur pcur-next;}return NULL; }//添加通讯录数据 void ContactAdd(Contact** con) {peoInfo info;printf(请输入要添加的联系人姓名\n);scanf(%s, info.name);printf(请输入要添加的联系人性别\n);scanf(%s, info.sex);printf(请输入要添加的联系人年龄\n);scanf(%d, info.age);printf(请输入要添加的联系人电话\n);scanf(%s, info.tel);printf(请输入要添加的联系人住址\n);scanf(%s, info.addr);SLTPushBack(con, info); } //删除通讯录数据 void ContactDel(Contact** con) {char name[NAME_MAX];printf(请输入要删除的联系人姓名\n);scanf(%s, name);Contact* ret FindByname(*con, name);if (ret ! NULL){SLTDelete(con, ret);printf(删除成功\n);}else{printf(数据不存在\n);return;} } //展示通讯录数据 void ContactShow(Contact* con) {Contact* pcur con;printf(%s %s %s %s %s\n, 姓名, 性别, 年龄, 电话, 地址);while (pcur){printf(%s , pcur-data.name);printf(%s , pcur-data.sex);printf(%d , pcur-data.age);printf(%s , pcur-data.tel);printf(%s , pcur-data.addr);printf(\n);pcur pcur-next;} } //查找通讯录数据 void ContactFind(Contact* con) {assert(con);char name[NAME_MAX];printf(请输入要查找的联系人姓名\n);scanf(%s, name);Contact* ret FindByname(con, name);if (ret ! NULL){printf(查找成功\n);printf(%s %s %s %s %s\n, 姓名, 性别, 年龄, 电话, 地址);printf(%s , ret-data.name);printf(%s , ret-data.sex);printf(%d , ret-data.age);printf(%s , ret-data.tel);printf(%s , ret-data.addr);printf(\n);}else{printf(数据不存在\n);return;} } //修改通讯录数据 void ContactModify(Contact** con) {char name[NAME_MAX];printf(请输入要修改的联系人姓名\n);scanf(%s, name);Contact* ret FindByname(*con, name);if (ret ! NULL){printf(请输入新的联系人姓名\n);scanf(%s, ret-data.name);printf(请输入新的联系人性别\n);scanf(%s, ret-data.sex);printf(请输入新的联系人年龄\n);scanf(%d, (ret-data.age));printf(请输入新的联系人电话\n);scanf(%s, ret-data.tel);printf(请输入新的联系人住址\n);scanf(%s, ret-data.addr);printf(修改成功\n);}else{printf(数据不存在\n);return;} } //销毁通讯录数据 void ContactDestroy(Contact** con) {SLTDestory(con); } 三、主函数 3.1 main.c #define _CRT_SECURE_NO_WARNINGS 1#includestdio.h #includeSList.h #includeContact.hvoid menu() {printf(******************通讯录******************\n);printf(*******1.增加联系人 2.删除联系人********\n);printf(*******3.修改联系人 4.查找联系人********\n);printf(*******5.展示联系人 0. 退出 *********\n);printf(******************************************\n); }int main() {int a -1;SLTNode* con NULL;do {menu();printf(请选择您的操作\n);scanf(%d, a);switch (a){case 1:ContactAdd(con);break;case 2:ContactDel(con);break;case 3:ContactModify(con);break;case 4:ContactFind(con);break;case 5:ContactShow(con);break;case 0:printf(退出通讯录....\n);break;default:printf(输入错误请重新选择您的操作\n);break;}} while (a ! 0);ContactDestroy(con);return 0; }
http://www.hkea.cn/news/14440699/

相关文章:

  • 同一个ip网站太多 seo阳江公司网站建设
  • 兴宁市住房和城乡规划建设局网站网站建设与管理提纲
  • 网站制作 常见问题我做夫人那些年网站登录
  • 广州有建网站的公司吗专业做网站建设公司好吗
  • 教育类网站怎么做免费发布活动的平台
  • 家居企业网站建设教程自己代理一款手游需要多少钱
  • 网站怎么制作成软件网站怎么做子网页
  • 网站建设企业关键词专业的营销型网站企业文化
  • 男女做暖暖的试看网站网站根目录在哪儿
  • 做网站需要什么准备做网站的
  • 佛山新网站建设信息手工制作大全创意废物利用
  • 网站建设为大学生服务大石桥网站建设
  • 湖北什么网站建设值得推荐临沂百度seo
  • 河北省建设资格执业中心网站企业网站要怎么做
  • 广州市企业网站制作公司做网站用不用云服务器
  • 梧州网站建设制作seo主要做哪些工作
  • 企业网站定制公司苍南网站建设公司
  • 开原网站网站建设如何制作课程网站模板下载地址
  • 网页网站设计价格net网站开发教学视频
  • 迁西网站建设校园网站建设方案书
  • 站长工具seo诊断网站建设实战案例
  • 临沂谁会做网站c#做交易网站
  • 湖北省建设厅七大员报名网站建网站先要申请网址吗
  • python做流量网站导航网站开发用户文档
  • 建设com网站网站建设捌金手指花总五
  • 网站开发公司怎么找客户html基本标签
  • 建设银行 网站江西网站建设企业
  • 哪些网站的做的好看的企业网站建设的步骤
  • 如何给网站加引导页企业网站系统官网
  • 知名网站制作全包公司网页打不开