利用C语言编写一段程序,能够实现身份证的查询 用链表的形式查询,如查询省——市——县等分开一个个查询

利用C语言编写一段程序,能够实现身份证信息的查询 用链表的形式查询,如查询省——市——县等分开一个个查询下,会的帮一下忙,要源代码,用C++也可以,要求输入以身份证号码先判断是否合法在输出地址信息 十万火急

#include <cstdlib>
#include <iostream>
#include <string.h>

/*******************************************
功 能: 身份证号查询
随机生成身份证号
typedef struct enum srand rand 使用演示
函数指针使用演示
Linux系统源代码中的公共列表LIST使用演示
文件名: codeid2.cpp
相关文件: 全国各地区的代码信息文件code.bin
作 者: 李永
日 期: 2010.9.4
******************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys\timeb.h>
#include <conio.h>
#include <dos.h>
using namespace std;

typedef struct list_head{
struct list_head *next;
struct list_head *prev;
}LIST;

typedef struct _Page{

LIST sort_list;
long Code;
char Name[100];
int Hash;
LIST Hash_List;
}PAGE;

//用于读写文件
typedef struct _context{
long Code; //地区代码,6位整数
char Name[100]; //地区信息
} IDCODE;

typedef enum _member_list_name{
sort_list,Hash_List
}MEMBER_LIST_NAME;

typedef struct _person_id {
char Code[19]; //个人身份证号码
} PERSON_ID;

typedef struct{
long Code; //地区代码,6位长
char Name[100];//地区代码的名称,即地址信息
int Year;
int Month;
int Day;
int Sex;
PERSON_ID _id; //18位个人身份证号码
} ID_INFOR;

//存放系统当前的日期和时间
typedef struct{
int year;
int month;
int day;
int hour,minute, second;
int weekday;
}SYSDATE;

//初始化列表的头指针,让它指向自己
#define Init_List(ptr) do { \
(ptr)->next = (ptr); \
(ptr)->prev = (ptr); \
} while (0)

//由一个结构ptr,计算出它所在的宿主结构的地址
//type 宿主结构的类型名称
//member 是ptr在宿主结构中的名称
#define list_entry(ptr,type,member) \
((type*)((char*)(ptr)-(unsigned long)(&((type*)0)->member)))

#define MAX_NUM 20

typedef int (*PFUN_COMPARE)(LIST * _list1, LIST * _list2,MEMBER_LIST_NAME ListName);
typedef void(*PFUN_PRINT)(LIST*head, MEMBER_LIST_NAME ListName);
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-11-11
都是JAVA了,C的格式都还给老师了。。。。
相似回答