C++实现简单的信息管理系统实现简单的信息管理系统
本文为大家分享C++实现简单的信息管理系统,小编之前在学习的时候也要做一些管理系统,在网上查了许多资料,现在我把
资料分享给大家,希望能够帮助到大家。
#include <stdio.h>
#include <stdlib.h>
#include "file.h"
void savaList(Node *head)/**把用户录入的数据存储到文件里面去方便下次读取*/
{
FILE *fp=fopen("data\data.txt" ,"w") ;
Node *p ;
for(p=head->next;p;p=p->next)
{
fwrite(&(p->data),sizeof(students),1,fp) ;
}
fclose(fp) ;
}
void duquLisr(Node *head)/**读取用户之前所录入的数据 */
{
FILE *fp=fopen("data\data.txt" ,"r") ;
students e ;
while( fread(&e,sizeof(students) ,1,fp ) )
{
insertList(head,e) ;
}
fclose(fp) ;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "goods.h"
/**录入数据,函数目的返回一个goods类型的值*/ /** char name[M] ;
char phone[M] ;
char street[M] ;
char city[M] ;
char youb[M] ; */
students lurushuju()
{
students e ;
printf("请输入学生的姓名 ") ;
scanf("%s",e.name);
printf("请输入学生的电话 ") ;
scanf("%s",e.phone) ;
printf("请输入学生的街道 ") ;
scanf("%s",e.street) ;
printf("请输入学生的城市信息 ") ;
scanf("%s",e.city) ;
printf("请输入学生的邮编 ") ;
scanf("%s",e.youb) ;
return e ;
}
void shuchushuju(students e)/**依次输出数据e*/
{
printf("%15s%15s%15s%15s%15s" , e.name ,e.phone,e.street,e.city,e.youb) ;