当前位置:网站首页>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:
边栏推荐
猜你喜欢
大龄测试员刚迈过了 35 岁这个“坎儿”,和大家说点儿心里话
dlopen failed: library "libtaml.so" not found
安全知识培训——消防安全
Leetcode81. 搜索旋转排序数组 II
FITC标记生物素(FITC-生物素|CAS:134759-22-1)有哪些知识了?
3.9 - 正规表达式和正规集 3.10 - 有限自动机
3.11-程序基本的控制语句 3.12-表达式 3.13-数据类型 3.14-常量/变量 3.15-标识符
deepstream学习笔记(三):deepstream-imagedata-multistream解析与接入适配yolov5模型测试
Leetcode83. 删除排序链表中的重复元素
3.4 - 编译与解释 3.5 - 编译过程 3.8 - 文法
随机推荐
Biotin-Cy2 Conjugate,生物素-Cy2 偶联物_Cy2 生物素偶联物
-采花生-
vmware Exsi 网卡配置
深入理解Aarch64内存管理
Kubernetes YAML编写 讲解
第十五章 mysql存储过程与存储函数课后练习
The technical aspects of the byte have been passed, and the salary has been negotiated for 20K*13, but the result is still being brushed. I asked the HR why...
WPF DataGrid using data templates
LeetCode常见题型——链表
断开和服务器共享连接的方法「建议收藏」
网络协议05 -网络层
2022金九银十工作潮,怎么样才能成功跳槽面试拿到高薪呢?
线程的同步与互斥
关于HBuilder X鼠标变为_ 替换字符的问题
如何抑制告警风暴?
C language learning journey [operator (incomplete version)]
nfs配置
-红与黑-
使用C语言实现静态链表
PEG 衍生物Biotin-PEG1-OH(cas:95611-10-2,2-生物素氨基乙醇)优势说明