C语言实现的通讯录数据表增删改查操作

版权申诉
0 下载量 128 浏览量 更新于2024-10-18 1 收藏 11KB ZIP 举报
资源摘要信息:"本资源是一个名为‘first_item.zip’的压缩文件,其中包含了用C语言编写的一个通讯录程序,实现了通讯录数据的增加、删除、修改和查询(即增删改查)功能。程序主要运用了数据结构的知识来存储和管理通讯录中的联系人信息。" 知识点详细说明: 1. C语言基础:C语言是一种广泛使用的计算机编程语言,具有强大的功能,它支持结构化编程、模块化设计和多种数据类型。在本资源中,C语言被用于实现程序逻辑和操作系统的接口。 2. 数据结构应用:数据结构是计算机存储、组织数据的方式,它决定了数据在计算机中的存储效率以及访问效率。在本通讯录程序中,可能使用了链表、数组、栈、队列或其他数据结构来存储和管理通讯录条目。例如,链表可以方便地在任意位置插入或删除节点,适合用来实现通讯录的动态添加和删除功能。 3. 增删改查功能实现:增删改查是许多软件应用中常见的基本操作。在本通讯录程序中,具体实现可能如下: - 增加(Create):程序提供了添加新的联系人信息到通讯录的功能,包括姓名、电话号码等信息的输入。 - 删除(Delete):允许用户根据一定的条件(如姓名或电话号码)删除通讯录中的现有条目。 - 修改(Update):当需要更改通讯录中的某个条目的信息时,用户可以执行修改操作,更新联系人的详细信息。 - 查询(Query):用户可以通过各种查询方式(如姓名、电话号码等)来检索通讯录中的条目。 4. C语言编程实践:编写C语言程序涉及对函数、数组、结构体、指针等概念的应用。例如,结构体可能被用来定义一个联系人数据类型,包含姓名、电话号码等字段。指针和动态内存分配(如malloc和free函数)用于链表操作,实现动态数据管理。 5. 压缩文件处理:资源文件以“first_item.zip”格式提供,表明它是一个经过压缩的文件。用户可能需要使用压缩软件(如WinRAR、7-Zip等)来解压文件,获取里面的C语言源代码文件和其他资源文件(如头文件、文档说明等)。 6. 错误处理和输入验证:在实际的C语言程序开发中,进行输入验证和错误处理是非常重要的,以确保程序的健壮性。对于通讯录程序来说,需要确保用户输入的数据是合法的,且在删除或修改操作时,需要检查要操作的条目是否确实存在于通讯录中。 7. 程序结构设计:良好的程序设计需要考虑程序的模块化,将功能划分成不同的部分(模块),每个模块负责程序中的一个具体功能。例如,增删改查中的每个操作都可以封装成一个函数或者模块,便于维护和扩展。 8. 接口设计与用户体验:程序接口设计的友好程度直接影响用户体验。在开发通讯录程序时,需要提供清晰的用户提示和帮助信息,让用户能够直观地了解如何操作程序,实现各项功能。 总结而言,本资源提供的C语言编写的通讯录程序,涉及了C语言编程、数据结构的实践应用、程序的基本功能实现、程序结构和接口设计等众多知识点。通过学习和实践这些知识点,可以加深对C语言和数据结构的理解,并提升编程能力。

import cv2 import face_recognition import numpy as np from PIL import Image, ImageDraw,ImageFont video_capture = cv2.VideoCapture(r'C:/Users/ALIENWARE/123.mp4')#如果输入是(0)为摄像头输入 #现输入为MP4进行识别检测人脸 first_image = face_recognition.load_image_file("1.jpg") first_face_encoding = face_recognition.face_encodings(first_image)[0] Second_image = face_recognition.load_image_file("2.jpg") Second_face_encoding = face_recognition.face_encodings(Second_image)[0] third_image = face_recognition.load_image_file("3.jpg") third_face_encoding = face_recognition.face_encodings(third_image)[0] inside_face_encodings = [first_face_encoding,Second_face_encoding,third_face_encoding] inside_face_names = ['A','B','C'] face_locations = [] face_encodings = [] face_names = [] process_this_frame = True while True: ret, frame = video_capture.read() small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) rgb_small_frame = small_frame[:, :, ::-1] if process_this_frame: face_locations = face_recognition.face_locations(rgb_small_frame) face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations) face_names = [] for face_encoding in face_encodings: matches = face_recognition.compare_faces(inside_face_encodings, face_encoding) name = '未录入人脸' if True in matches: first_match_index = matches.index(True) name = inside_face_names[first_match_index] face_names.append(name) process_this_frame = not process_this_frame for (top, right, bottom, left), name in zip(face_locations, face_names): top *= 4 right *= 4 bottom *= 4 left *= 4 cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2) img_pil = Image.fromarray(frame) draw = ImageDraw.Draw(img_pil) fontStyle = ImageFont.truetype("C:/Windows/Fonts/simsun.ttc", 32, encoding="utf-8") draw.text((left + 6, bottom - 6), name, (0, 200, 0), font=fontStyle) frame = np.asarray(np.array(img_pil)) cv2.imshow('face_out', frame) if cv2.waitKey(1) & 0xFF == ord('q'): #退出需要按下Q键否则内核会崩溃 break video_capture.release() cv2.destroyAllWindows()

2023-06-07 上传