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

米卓网站建设wordpress 图库

米卓网站建设,wordpress 图库,网站手机版后台,网站导航内链建设一.前言 嗨嗨嗨#xff0c;又和大家见面了#xff01;前面我们讲到了如何实现一个循序表。现在我们开始讲解如何基于循序表来实现通讯录功能。 二.正文 通讯录中的SeqlList.h #pragma once //#define SLDateType int #includestdio.h #includestdlib.h #…一.前言 嗨嗨嗨又和大家见面了前面我们讲到了如何实现一个循序表。现在我们开始讲解如何基于循序表来实现通讯录功能。 二.正文 通讯录中的SeqlList.h #pragma once //#define SLDateType int #includestdio.h #includestdlib.h #includeassert.h #includeContact.h typedef PerInfo SLDateType;//通讯录中SeqList.h与顺序表中SeqList.h的区别只是在通讯录中将int换成了结构体PerInfo typedef struct SeqList {SLDateType* arr;int size;int capacity; }SL; void SLInit();//循序表的初始化 void SLDestroy();//顺序表的销毁 void SLPushBack();//尾部插入 void SLPushFront();//头部插入 void SLPopBack();//尾部删除 void SLPopFront();//头部删除 void SLInsert();//指定位置插入 void SLErase();//指定位置删除 int SLFind();//查找数据 通讯录中的Contact.h #pragma once #define NAME_MAX 20 #define GENDER_MAX 20 #define TEL_MAX 20 #define ADDR_MAX 20 typedef struct PersonInfo {char name[NAME_MAX];char gender[GENDER_MAX];int age;char tel[TEL_MAX];char addr[ADDR_MAX]; }PerInfo; typedef struct SeqList Contact; void ContactInit(Contact* con);//通讯录的初始化 void ContactDestroy();//通讯录的销毁 void ContactAdd();//通讯录添加数据 void ContactDel();//通讯录删除数据 void ContactModify();//通讯录修改数据 int ContactFind();//通讯录查找数据 void ContactShow();//通讯录展示数据 通讯录中的SeqList.c #includeSeqList.h void SLInit(SL* ps)//循序表的初始化函数的实现 {ps-arr NULL;ps-size ps-capacity 0; } void SLDestroy(SL* ps)//顺序表销毁的函数实现 {if ((ps-arr) ! NULL){free(ps-arr);}ps-arr NULL;ps-size ps-capacity 0; } void SLCheckCapacity(SL* ps) {if (ps-capacity ps-size){int NewCapacity ps-capacity 0 ? 6 : 2 * ps-capacity;SLDateType* tmp (SLDateType*)realloc(ps-arr, NewCapacity * sizeof(SLDateType));if (tmp NULL){perror(realloc faile!);return ;}ps-arr tmp;ps-capacity NewCapacity;}} //void SLPrint(SL* ps) //{ // for (int i 0; i ps-size; i) // { // printf(%d , ps-arr[i]); // } // printf(\n); //} //void SLPrint(SL s) //{ // for (int i 0; i s .size; i) // { // printf(%d , s.arr[i]); // } // printf(\n); //} void SLPushBack(SL* ps, SLDateType x)//尾插函数的实现 {assert(ps);SLCheckCapacity(ps);ps-arr[ps-size] x;ps-size; } void SLPushFront(SL* ps, SLDateType x)//头插函数的实现 {assert(ps);SLCheckCapacity(ps);for (int i ps-size; i 0; i--){ps-arr[i] ps-arr[i - 1];}ps-arr[0] x;ps-size; } void SLPopBack(SL* ps)//尾删函数的实现 {assert(ps);assert(ps-size);ps-size--; } void SLPopFront(SL* ps)//头删函数的实现 {for (int i 0; i (ps-size) - 1; i){ps-arr[i] ps-arr[i 1];}ps-size--; } void SLInsert(SL* ps, int pos, SLDateType x)//指定位置的插入 {assert(ps);assert(pos 0 pos ps-size);SLCheckCapacity(ps);for (int i ps-size; i pos 1; i--){ps-arr[i] ps-arr[i - 1];}ps-arr[pos] x;ps-size; } void SLErase(SL* ps, int pos) {assert(ps);assert(pos 0 pos ps-size);for (int i pos; i ps-size - 2; i){ps-arr[i] ps-arr[i 1];}ps-size--; } //int SLFind(SL* ps, SLDateType x) //{ // assert(ps); // for (int i 0; i ps- size; i) // { // if (ps-arr[i] x) // { // return i; // } // } // return -1; //} 通讯录中的Contact.c #define _CRT_SECURE_NO_WARNINGS #includeSeqList.h #includeSeqList.h #includeContact.h #includestring.h void ContactInit(Contact* con) {SLInit(con);} void ContactDestroy(Contact* con) {SLDestroy(con); }void ContactAdd(Contact* con) {PerInfo pf;printf(请输入用户的姓名\n);scanf(%s, pf.name);printf(请输入用户的性别\n);scanf(%s, pf.gender);printf(请输入用户的年龄\n);scanf(%d, pf.age);printf(请输入用户的电话\n);scanf(%s, pf.tel);printf(请输入用户的地址\n);scanf(%s, pf.addr);SLPushBack(con, pf); }int ContactFind(Contact* con,char name[]){for (int i 0; i con-size; i){if (0strcmp(con-arr[i].name, name)){return i;}}return -1;}void ContactDel(Contact* con){char name[NAME_MAX];printf(请输入你要删除的联系人姓名\n);scanf(%s, name);int find ContactFind(con, name);if (find 0){printf(没有找到该联系人\n);ContactShow(con);return;}else{SLErase(con, find);printf(删除成功\n);return;}}void ContactShow(Contact* con){printf(姓名 );printf(性别 );printf(年龄 );printf(电话 );printf(地址 );printf(\n);for (int i 0; i con-size; i){printf(%s ,con-arr[i].name);printf(%s , con-arr[i].gender);printf(%d , con-arr[i].age);printf(%s , con-arr[i].tel);printf(%s , con-arr[i].addr);printf(\n);}}void ContactModify(Contact* con){char name[NAME_MAX];printf(输入要修改人姓名\n);scanf(%s, name);int find ContactFind(con, name);if (find 0){printf(要修改的联系人数据不存在\n);ContactShow(con);return;}//直接修改printf(请输入新的姓名\n);scanf(%s, con-arr[find].name);printf(请输入新的性别\n);scanf(%s, con-arr[find].gender);printf(请输入新的年龄\n);scanf(%d, con-arr[find].age);printf(请输入新的电话\n);scanf(%s, con-arr[find].tel);printf(请输入新的住址\n);scanf(%s, con-arr[find].addr);printf(修改成功\n);} 测试通讯录功能test.c //#define _CRT_SECURE_NO_WARNINGS #includeSeqList.h #includeContact.h int main() {//SL sl;//SLInit(sl);//SLPushBack(sl, 0);//SLPushBack(sl, 1);//SLPushBack(sl, 2);//SLPushBack(sl, 3);//SLPushFront(sl, 3); // SLPushFront(sl, 4);//SLPopBack(sl); // SLPopFront(sl);// SLInsert(sl, 3, 99);//SLErase(sl, 1);/*SLFind(sl, 2);SLPrint(sl);int find SLFind(sl, 2);if (find 0){printf(没有找到\n);}else{printf(找到了该数据下标是%d\n, find);}*/Contact Con;ContactInit(Con);ContactAdd(Con);ContactAdd(Con);//ContactShow(Con);ContactDel(Con);ContactDestroy(Con);return 0; } 三.结言 今天的分享结束下次再见了同学们
http://www.w-s-a.com/news/473806/

相关文章:

  • 有哪些做排球比赛视频网站wordpress 教师工作坊
  • 深圳好点的网站建设公司互联网企业信息服务平台
  • 下载空间大的网站建设哈尔滨网站制作软件
  • 南城网站仿做无锡网站制作哪家价格便宜
  • c做的网站营销策划课程
  • 免费网站404免费进入重庆的公需科目在哪个网站做
  • 网站空间租用费用网站建设公司怎么宣传
  • 镇江网站建设优化案例分析dw2018网页制作步骤图文
  • 网站开发一个多少钱为什么前端都不用dw
  • 网站降权的原因北京中小企业网站建设公司
  • 个人域名能做网站吗wordpress
  • 手机网站设计只找亿企邦工业设计公司简介
  • 腾讯云主机做网站免费网站怎么做啊
  • 网站建设推广销售话术广州网页定制多少钱
  • 备案号是哪个网站项目管理pmp
  • 做网站需要哪些硬件软件网站视频链接怎么做的
  • 电子商务网站建设试题二wordpress主页显示浏览数
  • 网站快照没了广州企业电话大全
  • 网站项目开发收费标准网站开发app开发主营业务
  • 怎么到国外网站去接模具订单做互联网建设企业网站
  • 深圳品牌网站建设公司排名洪雅网站建设
  • nodejs 做网站wordpress主题绕过激活码
  • 平湖模板网站建设公司网页美工培训
  • 顺德网站建设市场建设工程交易中心网站
  • 深圳企业网站怎么做浪琴手表网站建设图
  • 2018网站外链怎么做济南 网站设计公司
  • 承德百度网站建设郑州网站seo优化公司
  • 四川建站模板网站公司分类信息网站制作
  • 网站开发前后端有wordpress模板安装教程视频教程
  • 有网站想修改里面的内容怎么做怎么做黑彩黑彩网站