资源简介
数据结构课程设计----校园导游咨询系统
用无向网表示学校的校园景点平面图,图中顶点表示主要景点,
存放景点的编号、名称、简介等信息,图中的边表示景点间的道路,存放路径长度等信息。能够回答有关景点介绍、寻找最短路径、用户留下对校园、显示校园平面图的评价、用户登录等问题。

代码片段和文件信息
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxv = 50;
const int inf = 1000000;
typedef struct{
int G[maxv][maxv];
int G1[maxv][maxv];
int vis[maxv];
int d[maxv];
int pre[maxv];
}Graph;
typedef struct LNode
{
char name[10];
char pass[10];
struct LNode *next;
} LNode*pNode;
//定义节点
int way[maxv] = {0};
int n = 20m;
int count1 = 0;
const int maxsize = 10000;
char mean[25][15] = {“““校门““教学楼““马克思楼““超市““宿舍(40)““餐厅““菜鸟驿站““礼堂““共享单车““图书馆““养心湖“\
“汽车站““宾馆““宿舍(20)““体育馆““医院““基础实验大楼““银行““公园““小吃街“};
pNode createList()
{
//此函数是为了构造一个链表,存储用户信息用的。
pNode pHead = (pNode)malloc(sizeof(LNode));
pHead->next=NULL;
//以读的方式打开user.txt文件
FILE *fp = fopen(“D:\\user.txt““r+“);
if(fp == NULL)
{
printf(“文件未找到“);
exit(-1);
}
//获取链表入口,也就是头结点
pNode cur = pHead;
while(1)
{
//从user.text循环读入所有数据并依次存于链表
pNode temp = (pNode)malloc(sizeof(LNode));
if(!temp)
exit(-1);
//下面fscanf是从文件读取信息,并存入节点的name变量和pass变量
//如果fscanf的返回值不是2,则说明后面没有数据了,也即是录入完毕
//检测到录入完毕后将分配的空间清除掉
if(2!=fscanf(fp“%s%s“temp->nametemp->pass))
{
free(temp);
break;
}
cur->next=temp;
cur = temp;
cur->next = NULL;
}
return pHead;
}
//登录函数
int login(pNode head)
{
if(NULL==head->next)
{
printf(“暂无用户\n“);
getchar();
return 0;
}
char name[10];
char pass[10];
printf(“\t\t请输入你的用户名:“);
scanf(“%s“name);
printf(“\t\t请输入你的密码:“);
scanf(“%s“pass);
pNode temp = head->next;
while(temp)
{
if(0==strcmp(temp->namename) && 0==strcmp(temp->passpass))
{
printf(“\t\t成功登录\n“);
getchar();
return 1;
}
temp = temp->next;
}
printf(“未找到该用户\n“);
getch();
return 1;
}
//写入txt文件,每一行存在一个用户
void writeToFile(pNode head)
{
FILE *fw = fopen(“D:\\user.txt““a+“);
pNode temp=head->next;
if(temp==NULL){
return;
}
while(temp){
fprintf(fwtemp->name);
fprintf(fw“\t“);
fprintf(fwtemp->pass);
fprintf(fw“\n“);
temp = temp->next;
}
}
//注册用户
void registerUser(pNode head)
{
pNode temp = head->next;
//当表中无用户直接在头结点后注册
if(!temp)
{
temp = (pNode)malloc(sizeof(LNode));
head->next = temp;
}
else
{
//表中有用户则在最后一个节点后生成新节点
while(temp->next)
{
temp = temp->next;
}
pNode last = (pNode)malloc(sizeof(LNode));
temp->next = last;
temp = last;
}
printf(“\t\t请输入你的用户名:“);
scanf(“%s“temp->name);
printf(“\t\t请输入你的密码:“);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 25811 2020-07-03 18:09 course_design.cpp
文件 962382 2020-07-04 10:20 校园导游咨询系统论文.doc
- 上一篇:基于OpenCV的分水岭算法实现
- 下一篇:主数据管理MDM解决方案
相关资源
- 数据结构年终考题范围和答案 耿国华
- 数据结构 朱战力 习题解答 数据结构
- 数据结构课程设计 6 1 彩票系统
- 教学计划编制系统
- 大数(链表、数组)实现
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- 航空订票系统_数据结构课程设计
- 多项式求和(数据结构C 版)
- 尚观培训linux董亮老师关于数据结构的
- 数据结构 知识点总结
- 华南理工大学数据结构复习提纲二
- 华南理工大学数据结构复习提纲一
- 数据结构用C 写的停车场系统源代码
- 数据结构(河北科技大学)
- 数据结构考前习题 清华大学出版社
- 数据结构课件(北邮)
- 数据结构实验 基于栈的表达式求值
- 数据结构课程设计——图书管理系统
- 成绩管理系统(数据结构)
- 数据结构-最小通信网问题
- 数据结构课程设计同学通讯录系统
- 数据结构课程设计 公园导游图
- 数据结构殷人昆版的课后答案
- 2006年湖北工业大学409数据结构试题
- 数据结构实验-魔王语言-源码加实验报
- 简单计算器的实现(数据结构)
- 简单计算器的实现(数据结构 修正版
- Fundamentals of Data Structure in C
- 北京邮电大学数据结构历年考研真题
评论
共有 条评论