求求高手,说下怎么写备忘录??
我写了半天也只是写了个读写文件的东西出来,怎么才能弄出来个备忘录啊
#include<stdio.h>
#include<time.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
void addm(struct BEIWANG *m);
int countdown(int y,int m,int d);
void view(struct BEIWANG *m);
void delte(struct BEIWANG *m);
struct BEIWANG{
char title[10];
char n[100];
int year;
int month;
int day;
};
static int len=0;
main()
{ struct BEIWANG mess[3];
int n;
while(1){
printf("***********************************************************\n");
printf(" 我的备忘录 \n");
printf("***********************************************************\n");
printf(" 1.添加 \n");
printf(" 2.查看 \n");
printf(" 3.退出 \n");
printf(" \n");
printf("************************************************************\n");
printf("请输入要选择的数字:\n");
scanf("%d",&n);
switch(n)
{
case 1:addm(mess);
break;
case 2:view(mess);
break;
case 3:printf("退出!\n");
exit(0);
break;
}
}
}
void addm(struct BEIWANG *m)
{
printf("请输入题目:");
scanf("%s",m->title);
printf("请输入详细内容:");
scanf("%s",m->n);
printf("请输入时间:");
printf("年份:");
scanf("%d",&m->year);
printf("月份:");
scanf("%d",&m->month);
printf("日期:");
scanf("%d",&m->day);
while(getchar()!='\n');
len++;
}
void delte(struct BEIWANG *m)
{
struct BEIWANG messa;
printf("请输入要删除的信息:\n");
scanf("%s",messa.title);
}
int countdown(int y,int m,int d)
{
struct tm *aa;
int year,month,day;
time_t t;
int months[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int i,total_days=0;
time(&t);
aa=gmtime(&t);
year=aa->tm_year+1900;
month=aa->tm_mon+1;
day=aa->tm_mday;
total_days=(y-year)*365;
if(month>m)
{total_days-=365;
for(i=0;i<m;i++)
total_days+=months[i];
for(i=month;i<12;i++)
total_days+=months[i];
}
else
for(i=month;i<m;i++)
total_days+=months[i];
total_days+=(d-day);
return total_days;
}
void view(struct BEIWANG *m)
{
int i,days;
printf("\n***************************************************************\n");
printf(" | 题目 | 内容 |时间 | 距离今天还有()天 |\n");
printf("*****************************************************************\n");
for(i=0;i<len;i++)
{
printf("|%-8s|",m->title);
printf(" %-26s|",m->n);
printf("%d-%2d-%3d |",m->year,m->month,m->day);
days=countdown(m->year,m->month,m->day);
printf(" %-16d天|\n",days);
printf("*****************************************************************|\n");
m++;
}
getch();
}