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

成都那家网站做的好wordpress 数据库表可视化

成都那家网站做的好,wordpress 数据库表可视化,广州牌具做网站的公司,网站维护是什么职位一.前言 上次带大家认识了一下顺序表#xff0c;其实我们可以在顺序表的基础上实现一个通讯录的小项目#xff0c;通讯录的本质仍然是顺序表#xff0c;所以如果下面的代码你有问题的话#xff0c;先去看看我的上篇文章哦~。 通讯录的功能大家应该都知道吧#xff0c;这次…一.前言 上次带大家认识了一下顺序表其实我们可以在顺序表的基础上实现一个通讯录的小项目通讯录的本质仍然是顺序表所以如果下面的代码你有问题的话先去看看我的上篇文章哦~。 通讯录的功能大家应该都知道吧这次我们就要用C语言实现一个通讯录的基本功能 储存人的信息 其中每个人的信息包括 名字 性别 年龄 地址 电话号码 增加人的信息删除指定人的信息修改指定人的信息查找指定人的信息查看通讯录的信息 二.功能实现 1.通讯录信息格式的初始化  #pragma once //#includestdio.h //#includeSeqList.h #define NAME_MAX 100 #define GENDER_MAX 12 #define TEL_MAX 12 #define ADDR_MAX 100 //通讯录数据类型 typedef struct PersonInfo {char name[NAME_MAX];int age;char gender[GENDER_MAX];char tel[TEL_MAX];char addr[ADDR_MAX]; }Info;struct SeqList; typedef struct SeqList Contact; //通讯录提供的操作//通讯录的初始化和销毁 void ContactInit(Contact*pcon); void ContactDestory(Contact* pcon);//增删修查 void ContactAdd(Contact* pcon); void ContactDel(Contact* pcon); void ContactModify(Contact* pcon); void ContactFind(Contact* pcon); void ContactShow(Contact* pcon);2.通讯录初始化 void ContactInit(Contact* pcon) {SLInit(pcon); } //SLInit(pcon)函数的伪代码如下 void SLInit(SL* ps) {ps-arr NULL;ps-size ps-capacity 0; } 3.添加联系人 void ContactAdd(Contact* pcon) {Info info;printf(请输入联系人姓名:\n);scanf(%s, info.name);printf(请输入联系人年龄:\n);scanf(%d, info.age);printf(请输入联系人性别:\n);scanf(%s, info.gender);printf(请输入联系人电话:\n);scanf(%s, info.tel);printf(请输入联系人地址:\n);scanf(%s, info.addr);//保存数据到通讯录里通讯录SLPushBack(pcon,info); } 4.删除联系人 void ContactDel(Contact* pcon) {//删除之前先查找printf(请输入联系人姓名\n);char name[NAME_MAX];scanf(%s, name);int findIndex FindByName(pcon,name);if (findIndex 0){printf(要删除的联系人不存在\n);return;}SLErase(pcon, findIndex);printf(联系人删除成功\n);} //FindByName(pcon,name)函数的伪代码如下 int FindByName(Contact*pcon,char name[]) {for (int i0;ipcon-size;i){if (strcmp(pcon-arr[i].name, name) 0){return i;}}return -1; } 5.修改联系人信息 void ContactModify(Contact* pcon) {printf(请输入联系人姓名\n);char name[NAME_MAX];scanf(%s, name);int findIndex FindByName(pcon, name);if (findIndex 0){printf(要修改的联系人不存在\n);return;}//找到了printf(请输入联系人姓名:\n);scanf(%s, pcon-arr[findIndex].name);printf(请输入联系人年龄:\n);scanf(%d, pcon-arr[findIndex].age);printf(请输入联系人性别:\n);scanf(%s, pcon-arr[findIndex].gender);printf(请输入联系人电话:\n);scanf(%s, pcon-arr[findIndex].tel);printf(请输入联系人地址:\n);scanf(%s, pcon-arr[findIndex].addr);printf(联系人修改成功\n);}6.查找联系人信息 void ContactFind(Contact*pcon) {char name[NAME_MAX];printf(请输入要查找的联系人的姓名\n);scanf(%s,name);int findIndex FindByName(pcon, name);if (findIndex 0){printf(要查找的联系人不存在\n);return;}printf(%s %s %s %s %s\n,姓名,年龄,性别,电话,住址);printf(%s %d %s %s %s\n,pcon-arr[findIndex].name,pcon-arr[findIndex].age,pcon-arr[findIndex].gender,pcon-arr[findIndex].tel,pcon-arr[findIndex].addr);} 7.打印通讯录信息 void ContactShow(Contact* pcon) {printf(%s %s %s %s %s\n, 姓名, 年龄, 性别, 电话, 住址);for (int i 0; i pcon-size; i){printf(%s %d %s %s %s\n,pcon-arr[i].name,pcon-arr[i].age,pcon-arr[i].gender,pcon-arr[i].tel,pcon-arr[i].addr);} } 三.SeqList.h #define _CRT_SECURE_NO_WARNINGS 1 #define _CRT_SECURE_NO_WARNINGS 1 #pragma once #includestdio.h #includestdlib.h #includeassert.h #includeContact.h//静态顺序表//#define N 100 //struct SeqList //{ // SLDataType a[N]; // int size; //};//动态顺序表//typedef int SLDataType; typedef Info SLDataType;typedef struct SeqList {SLDataType* arr; //存储数据的底层结构int capacity; //记录顺序表的空间大小int size; //记录顺序表当前有效的数据个数 }SL;//typedef struct SeqList SL;//初始化和销毁 void SLInit(SL* ps); void SLDestroy(SL* ps); void SLPrint(SL* ps); //保持接口一致性//顺序表的头部/尾部插入 void SLPushBack(SL* ps, SLDataType x); void SLPushFront(SL* ps, SLDataType x);//顺序表的头部/尾部删除 void SLPopBack(SL* ps); void SLPopFront(SL* ps);//指定位置之前插入数据 //删除指定位置数据 void SLInsert(SL* ps, int pos, SLDataType x); void SLErase(SL* ps, int pos); int SLFind(SL* ps, SLDataType x);四.SeqList.c #define _CRT_SECURE_NO_WARNINGS 1 #includeSeqList.h //初始化和销毁 void SLInit(SL* ps) {ps-arr NULL;ps-size ps-capacity 0; }void SLCheckCapacity(SL* ps) {if (ps-size ps-capacity) {int newCapacity ps-capacity 0 ? 4 : 2 * ps-capacity;SLDataType* tmp (SLDataType*)realloc(ps-arr, newCapacity * sizeof(SLDataType));if (tmp NULL) {perror(realloc fail!);exit(1);}//扩容成功ps-arr tmp;ps-capacity newCapacity;} }//顺序表的头部/尾部插入 void SLPushBack(SL* ps, SLDataType x) {//断言--粗暴的解决方式//assert(ps ! NULL);assert(ps);//if判断--温柔的解决方式//if (ps NULL) {// return;//}//空间不够扩容SLCheckCapacity(ps);//空间足够直接插入ps-arr[ps-size] x;//ps-size; } void SLPushFront(SL* ps, SLDataType x) {assert(ps);//判断是否扩容SLCheckCapacity(ps);//旧数据往后挪动一位for (int i ps-size; i 0; i--) //i 1{ps-arr[i] ps-arr[i - 1]; //ps-arr[1] ps-arr[0]}ps-arr[0] x;ps-size; }//顺序表的头部/尾部删除 void SLPopBack(SL* ps) {assert(ps);assert(ps-size);//顺序表不为空//ps-arr[ps-size - 1] -1;ps-size--; } void SLPopFront(SL* ps) {assert(ps);assert(ps-size);//不为空执行挪动操作for (int i 0; i ps-size - 1; i){ps-arr[i] ps-arr[i 1];}ps-size--; }//指定位置之前插入数据 void SLInsert(SL* ps, int pos, SLDataType x) {assert(ps);assert(pos 0 pos ps-size);SLCheckCapacity(ps);//pos及之后的数据往后挪动一位pos空出来for (int i ps-size; i pos; i--){ps-arr[i] ps-arr[i - 1]; //ps-arr[pos1] ps-arr[pos]}ps-arr[pos] x;ps-size; } //删除指定位置数据 void SLErase(SL* ps, int pos) {assert(ps);assert(pos 0 pos ps-size);//pos以后的数据往前挪动一位for (int i pos; i ps-size - 1; i){ps-arr[i] ps-arr[i 1];//ps-arr[i-2] ps-arr[i-1];}ps-size--; } //查找x //int SLFind(SL* ps, SLDataType x) //{ // assert(ps); // for (int i 0; i ps-size; i) // { // if (ps-arr[i] x) // return i; // } // return -1; //} void SLDestroy(SL* ps) {assert(ps);if (ps-arr){free(ps-arr);}ps-arr NULL;ps-size ps-capacity 0; }void SLPrint(SL* ps) {for (int i 0; i ps-size; i){printf(%d , ps-arr[i]);}printf(\n); } 五.Contact.h #pragma once //#includestdio.h //#includeSeqList.h #define NAME_MAX 100 #define GENDER_MAX 12 #define TEL_MAX 12 #define ADDR_MAX 100 //通讯录数据类型 typedef struct PersonInfo {char name[NAME_MAX];int age;char gender[GENDER_MAX];char tel[TEL_MAX];char addr[ADDR_MAX]; }Info;struct SeqList; typedef struct SeqList Contact; //通讯录提供的操作//通讯录的初始化和销毁 void ContactInit(Contact*pcon); void ContactDestory(Contact* pcon);//增删修查 void ContactAdd(Contact* pcon); void ContactDel(Contact* pcon); void ContactModify(Contact* pcon); void ContactFind(Contact* pcon); void ContactShow(Contact* pcon); 六.Contact.c #define _CRT_SECURE_NO_WARNINGS 1 #includeContact.h #includeSeqList.h //通讯录的初始化和销毁 void ContactInit(Contact* pcon) {SLInit(pcon); } void ContactDestory(Contact* pcon) {SLDestroy(pcon); }//增删修查 void ContactAdd(Contact* pcon) {Info info;printf(请输入联系人姓名:\n);scanf(%s, info.name);printf(请输入联系人年龄:\n);scanf(%d, info.age);printf(请输入联系人性别:\n);scanf(%s, info.gender);printf(请输入联系人电话:\n);scanf(%s, info.tel);printf(请输入联系人地址:\n);scanf(%s, info.addr);//保存数据到通讯录里通讯录SLPushBack(pcon,info); } int FindByName(Contact*pcon,char name[]) {for (int i0;ipcon-size;i){if (strcmp(pcon-arr[i].name, name) 0){return i;}}return -1; } //void ContactFind(Contact* pcon) //{ // //} void ContactDel(Contact* pcon) {//删除之前先查找printf(请输入联系人姓名\n);char name[NAME_MAX];scanf(%s, name);int findIndex FindByName(pcon,name);if (findIndex 0){printf(要删除的联系人不存在\n);return;}SLErase(pcon, findIndex);printf(联系人删除成功\n);} void ContactModify(Contact* pcon) {printf(请输入联系人姓名\n);char name[NAME_MAX];scanf(%s, name);int findIndex FindByName(pcon, name);if (findIndex 0){printf(要修改的联系人不存在\n);return;}//找到了printf(请输入联系人姓名:\n);scanf(%s, pcon-arr[findIndex].name);printf(请输入联系人年龄:\n);scanf(%d, pcon-arr[findIndex].age);printf(请输入联系人性别:\n);scanf(%s, pcon-arr[findIndex].gender);printf(请输入联系人电话:\n);scanf(%s, pcon-arr[findIndex].tel);printf(请输入联系人地址:\n);scanf(%s, pcon-arr[findIndex].addr);printf(联系人修改成功\n);}void ContactShow(Contact* pcon) {printf(%s %s %s %s %s\n, 姓名, 年龄, 性别, 电话, 住址);for (int i 0; i pcon-size; i){printf(%s %d %s %s %s\n,pcon-arr[i].name,pcon-arr[i].age,pcon-arr[i].gender,pcon-arr[i].tel,pcon-arr[i].addr);} } void ContactFind(Contact*pcon) {char name[NAME_MAX];printf(请输入要查找的联系人的姓名\n);scanf(%s,name);int findIndex FindByName(pcon, name);if (findIndex 0){printf(要查找的联系人不存在\n);return;}printf(%s %s %s %s %s\n,姓名,年龄,性别,电话,住址);printf(%s %d %s %s %s\n,pcon-arr[findIndex].name,pcon-arr[findIndex].age,pcon-arr[findIndex].gender,pcon-arr[findIndex].tel,pcon-arr[findIndex].addr);}七.Contest.c #define _CRT_SECURE_NO_WARNINGS 1 //#includeContact.h #includeSeqList.h void menu() {printf(*****************通讯录***************\n);printf(*******1.添加联系人 2.删除联系人*****\n);//ctrldprintf(*******3.修改联系人 4.查找联系人*****\n);//ctrldprintf(*******5.查看通讯录 0. 退 出 ******\n);//ctrldprintf(**************************************\n); } int main() {int op 0;//创建通讯录结构Contact con;ContactInit(con);do{menu();printf(请输入需要的操作\n);scanf(%d,op);switch (op){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:break;}} while (op);//销毁通讯录ContactDestory(con);return 0; }
http://www.pierceye.com/news/832092/

相关文章:

  • 南通专业企业门户网站设计学校怎么创建网站
  • 网站策划与建设阶段的推广方法中国建设教育协会安全员证
  • 建设银行网站用户名更改分销微信小程序开发
  • 荣成做网站的公司百度地图 wordpress
  • 扁平设计网站湖南健康二维码app下载安装
  • 大连成久建设工程有限公司网站针对爬虫爬取做的优化
  • 建设官方网站企业网银登录网站版面设计
  • 网站建设学什么软件怎样创建自己的公众号
  • 网站脑图怎么做云伙伴小程序开发公司
  • 网站设置兼容模式怎么弄wordpress文件架构
  • 网站模块顺序调整网易对象存储wordpress
  • 深圳网络建设网站郑州网站优化服务
  • 辽阳专业建设网站公司网站html动态效果代码
  • 微信上可以做网站吗网页设计作业讲解
  • 长春好的做网站公司潍坊 网站
  • 做网站自己装服务器谷歌排名规则
  • 58.搜房等网站怎么做效果才好商贸公司企业简介模板
  • 中国最早做网站是谁卖网站怎样做
  • 张店专业网站优化哪家好书画工作室网站模板网站建设
  • 兰州网站制作怎么样青海哪家做网站的公司最大
  • 云龙湖旅游景区网站建设招标网站升级改版需要几天
  • 高端大气网络设计建设公司网站织梦模板沈阳模板建站哪家好
  • 郑州哪有做网站的高端网站建设与制作
  • 江阴网站网站建设蓝色 宽屏 网站 模板下载
  • 网站建设设计大作业重庆公共信息交易资源网
  • 做公司网站的多少钱公司建网站价格
  • 河间米各庄网站建设制作网站页面模板 建设中
  • wordpress首页添加站点统计小工具住房城乡建设部门门户网站
  • 网站建设在哪块做创业园网站建设
  • 郑州搭建网站公司互联网公司网站建设的目的