D:\TDDOWNLOAD\myclass2\class.cpp 2011年12月7日 16:03
/*
class.cpp
1
、从文本文件中导入班级学生信息:学号、姓名、性别、籍贯
2
、将学号重复的删除
3
、显示导入的学生信息
4
、按学号、姓名、性别、籍贯相等和不相等查找
5
、多次查找
6
、查找结果写入文件
7
、
VC++6.0
编译通过
******************
文件尾部有
class.txt
班级信息
*/
#include <stdio.h>
#include <malloc.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define CLRSCRsystem("cls")
#define PRINT_TITLE "
序号
学号
姓名
性别
籍贯
"
#define PRINT_FORMAT
"%d %s %s %s %s",i,p->stu.num,p->stu.name,p->stu.sex,p->stu.hometown
#define WRITE_FORMAT
"%s %s %s %s",p->stu.num,p->stu.name,p->stu.sex,p->stu.hometown
#define READ_FORMAT "%s %s %s %s",&p->stu.num,&p->stu.name,&p->stu.sex,&p->stu.hometown
//
定义学生结构体
struct student
{
char num[9];
char name[7];
//
三个汉字长度为
6
个字节,如果不多定义一个字节来存放字符串结束符
' '
,当输出
name
时会
把
sex
和
hometown
也输出
char sex[3];
char hometown[7];
};
//
定义单链表结点
typedef struct listnode
{
struct studentstu;
struct listnode *next;
}node;
int MySelect(node * head,node *temp) //
返回查找到符合条件的项目数
{
int equal,N;
-1-