当前位置:网站首页>C language structure, function and pointer exercise (simple address book)
C language structure, function and pointer exercise (simple address book)
2022-08-10 01:47:00 【BSP Junior Primary School Monk】
#include #include typedef struct{char name[20];long long phone;char sex[10];char dress[20];int age;}Person;Person person_arr[20]={{"Xiong Da",10086,"Male","Henan",24},{"Xiong Er", 10010, "Male", "Shaanxi", 23},{"Xiong San",911,"Male","Hubei",25}};void add(){int i,n;printf("Please enter how many address book friends you need to add this time:\n");scanf("%d",&n);for(i=0;iperson_arr[j+1].age){temp=person_arr[j];person_arr[j]=person_arr[j+1];person_arr[j+1]=temp;}}}}int main(){int n=100;while(n != 0){printf("The information of this address book list is as follows:\n");print();printf("The function is as follows:\n");printf("1. Add friends 2. Delete friends\n");printf("3. Search friends 4. Modify friends\n");printf("5. Print friends 6. Sort contacts\n");printf("0, exit\n");scanf("%d", &n);switch(n){case 1:add();break;case 2:del();break;case 3:seek();break;case 4:modify();break;case 5:print();break;case 6:classfy();break;default :break;}}return 0;}
Running result:
边栏推荐
- 知行合一的时候
- 3.11-程序基本的控制语句 3.12-表达式 3.13-数据类型 3.14-常量/变量 3.15-标识符
- The older tester has just passed the "hurdle" of being 35 years old, and I want to tell you something from my heart
- 二进制、八进制、十进制、十六进制之间的转换
- LeetCode常见题型——链表
- Redis redisTemplate.execute 执行锁
- Kubernetes 60个为什么
- Kubernetes 开发环境比对
- Redis-基本介绍/linux下环境配置/配置文件
- 02|运算符
猜你喜欢
Docker 面试题2则--取数据库连接数和docker-compose
[C language] In-depth understanding of pointers and arrays (issue 4)
Redis 非关系型数据库学习(一) ---- Redis 的安装
漫谈缺陷管理的自动化实践方案
Enhanced Deep Residual Networks for Single Image Super-Resolution
安全知识培训——消防安全
数字孪生电力系统,可视化应用实现科学调度的电子设备
温度响应性纳米水凝胶光子品体/纤维素修饰荧光水凝胶/载脂质体水凝胶的制备方法
【剑指offer】第一题 第二题
渗透测试与攻防对抗——漏洞扫描&逻辑漏洞(Part1)
随机推荐
【猜凶手,猜名次,杨辉三角】经典小学奥数的代码逻辑是什么?
LeetCode常见题型——链表
算法---整数替换(Kotlin)
-采花生-
JVM Memory and Garbage Collection - 10. Direct Memory
网络协议05 -网络层
-象棋比赛-
Redis 大 key 要如何处理?
Impala 疑问
Enhanced Deep Residual Networks for Single Image Super-Resolution
使用C语言实现静态链表
【「收藏」Oracle 数据库安装】
输入的这些数是否对称
[SUCTF 2019]CheckIn (.htaccess和.user.ini)
[SSH]如何敲一条线
Win11怎么关闭系统保护功能?系统保护还原功能怎么关闭?
02|运算符
PEG 衍生物Biotin-PEG1-OH(cas:95611-10-2,2-生物素氨基乙醇)优势说明
nfs配置
RebatMq消息中间件(一) 各个中间件介绍