通讯录管理系统(C语言版)

通讯录管理系统(C语言版)

课程题目:通讯录的制作设计目的:用双向链表作数据结构,结合C/C++语言基本知识。编写一个通讯录管理系统。以把所学数据结构知识应用到实际软件开发中去。设计内容:本系统应完成一下几方面的功能:输入信息——enter();显示信息———display( ); 查找以姓名作为关键字 ———search( ); 删除信息———delete( );存盘———save ( );装入———load( ) ; 设计要求: 1) 每条信息至包含 :姓名(NAME )街道(STREET)城市(CITY)邮编(EIP)国家(STATE)几项 2) 作为一个完整的系统,应具有友好的界面和较强的容错能力。
程序代码:


源码下载
可执行EXE文件


  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
好的,您想了解通讯录管理系统C语言实现。通讯录管理系统可以用来存储联系人的姓名、电话号码、地址等信息,并且可以进行添加、删除、修改、查询等操作。以下是一个简单的通讯录管理系统C语言实现。 ```c #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_CONTACTS 100 struct contact { char name[50]; char phone[20]; char address[100]; }; struct contact contacts[MAX_CONTACTS]; int num_contacts = 0; void add_contact() { if (num_contacts == MAX_CONTACTS) { printf("The contact list is full.\n"); return; } struct contact new_contact; printf("Enter the name: "); scanf("%s", new_contact.name); printf("Enter the phone number: "); scanf("%s", new_contact.phone); printf("Enter the address: "); scanf("%s", new_contact.address); contacts[num_contacts++] = new_contact; printf("Contact added.\n"); } void delete_contact() { if (num_contacts == 0) { printf("The contact list is empty.\n"); return; } char name[50]; printf("Enter the name of the contact to delete: "); scanf("%s", name); int found = 0; for (int i = 0; i < num_contacts; i++) { if (strcmp(name, contacts[i].name) == 0) { found = 1; for (int j = i; j < num_contacts - 1; j++) { contacts[j] = contacts[j + 1]; } num_contacts--; printf("Contact deleted.\n"); break; } } if (!found) { printf("Contact not found.\n"); } } void modify_contact() { if (num_contacts == 0) { printf("The contact list is empty.\n"); return; } char name[50]; printf("Enter the name of the contact to modify: "); scanf("%s", name); int found = 0; for (int i = 0; i < num_contacts; i++) { if (strcmp(name, contacts[i].name) == 0) { found = 1; printf("Enter the new phone number: "); scanf("%s", contacts[i].phone); printf("Enter the new address: "); scanf("%s", contacts[i].address); printf("Contact modified.\n"); break; } } if (!found) { printf("Contact not found.\n"); } } void display_contact() { if (num_contacts == 0) { printf("The contact list is empty.\n"); return; } for (int i = 0; i < num_contacts; i++) { printf("Name: %s\n", contacts[i].name); printf("Phone: %s\n", contacts[i].phone); printf("Address: %s\n", contacts[i].address); printf("\n"); } } int main() { int choice; while (1) { printf("1. Add a contact\n"); printf("2. Delete a contact\n"); printf("3. Modify a contact\n"); printf("4. Display all contacts\n"); printf("5. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); switch (choice) { case 1: add_contact(); break; case 2: delete_contact(); break; case 3: modify_contact(); break; case 4: display_contact(); break; case 5: exit(0); default: printf("Invalid choice.\n"); } printf("\n"); } return 0; } ``` 这个通讯录管理系统使用了一个结构体 `contact` 来存储每个联系人的信息,包括姓名、电话号码和地址。在主函数中,使用一个循环来显示菜单,让用户可以选择进行添加、删除、修改、查询等操作。每个操作都对一个函数,实现相功能。需要注意的是,这个通讯录管理系统最多只能存储100个联系人的信息

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值