购物清单及闹表

本文详述了作者首次尝试编写一个具备购物清单管理和闹钟提醒功能的应用程序,涵盖了从需求分析到代码实现的全过程,重点讨论了如何设置和触发闹钟提醒,以及如何在清单中添加和管理项目。
摘要由CSDN通过智能技术生成

记录第一次系统地写下一个实用代码

/*1.插入一条记录,包括需要采购物品的名称,采购的数量,单价,采购地点到商场的距离,用一个结构体实现。
2.对所有需要采购的物品按距离进行的排序。
3.对所有需要采购的物品按名称字典序进行的排序。
4.删除一条记录,按时间删除和按物品名删除。
5.查找对应时间需要采购的物品。
6.按物品名称查找相关信息(扩展需求:模糊搜索,比如名称为abc,输入a或输入b,也可显示该记录)。
7.修改某个物品需要采购的数量,单价。
8.到点提醒,到确切的时间,提醒老刘去采购相应的物品(获取系统时间即可)。*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h> 
#include <time.h>
#include <windows.h>
#include <process.h>
#define output "||||name:%s||number:%d||price:%.2lfyuan||place:%s||distance:%.2lfkm||time:%02do'clock||%02dminutes||%02dseconds||||\n"
#define DATA p->data.name,p->data.num,p->data.price,p->data.place,p->data.distance,p->data.hours,p->data.minutes,p->data.seconds
//定义购买清单结构体 
struct item{
	char name[30];
	int num;
	double price;
	char place[30];
	double distance;
	int hours;
	int minutes;
	int seconds;
};
//定义链表 
typedef struct Node{
	struct item data;/*存放数据*/ 
	struct Node* next;/*指针*/ 
}node,*head;
head l;
int ch; 
/*菜单、进入界面
	1.增添一条购物清单 
	2.删除一条购物清单
	3.更改一条购物清单
	4.输入时间来找到购物物品
	5.输入物品名称来找到购物清单记录
	6.按照距离排序
	7.按照字典序排序
	8.闹钟提醒服务*/ 
void list(){
	printf("Welcome to the shopping listing!\n");
	printf("Please enter a number as follows if you want to use the program:\n");
	printf("1.Add a shopping record.\n");
	printf("2.Delete a shopping record.\n");
	printf("3.Modify a shopping record.\n");
	printf("4.Enter the time to find the item.\n");
	printf("5.Enter the name of the item to find the shopping records.\n");
	printf("6.Sort by distance.\n");
	printf("7.Sort in alphabetical order\n");
	printf("I have alarm service~\n");
	printf("Hope you enjoy using the programe\(^o^)/~\n");
	printf("Please enter a number:\n");
}
//增添一条购物清单的函数
void add_list(void){
	system("CLS");
	char na[30],pl[30];
	int nu,ho,mi,se;
	double pr,di;
	node *p,*last;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值