How to use C++ to realize a simple campus tour guide system
Editor to share with you how to use C++ to achieve a simple campus tour guide system, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Let's go and learn about it!
The details are as follows
# include # define INF 32767int visited, password; / / password is the login password managed by the backend FILE * fp;char na; char str1, str3; int Nmaittint; using namespace std;typedef struct {int num; char name; char introduction;} VertexType;typedef struct {int edges; VertexType vex; VertexType vex } MGraph;typedef struct ANode {int adjvex; struct ANode * nextarc;} ArcNode;typedef struct Vnode {ArcNode * firstarc;} VNode;typedef VNode AdjList; typedef struct {AdjList adjlist; int nrecoe;} ALGraph;MGraph gape / open the text file and output the contents of the file void ReadData1 (MGraph & g) {Mendn; FILE * fp; int i = 0JEJ If ((fp=fopen ("path.txt", "r")) = = NULL) {printf ("error open!"); exit (0);} for (item0; in=g.n; G-> eSig.e;} / / find the introduction to the corresponding scenic spot void FindIntroduction (MGraph & g) {int xtraining d; while (1) {printf ("Please enter the number of the scenic spot you want to query:") Scanf ("% d", & x); ReadData (g); printf ("name of the scenic spot:% s\ n", g.vexe [x] .name); printf ("introduction to the scenic spot:"); printf ("% s\ n", g.vexx [x] .name); printf ("do you want to continue the query (0. Continue 1. Do not continue): "); scanf ("% d ", & d); while (1) {if (% d", & d) break; else {printf ("data entered is unreasonable, please re-enter:"); scanf ("% d", & d) }} if (dazzling 0) continue; else break;}} / / output the shortest path between two vertices void Dispath (MGraph & g void Dispath A [], int path []]) {int iGraink, printf ("Please enter the number of your location:"); scanf ("% d", & u) Printf ("Please enter the number of the location you want to go:"); scanf ("% d", & v); int apath [100], d; for (iTun0; I)