Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use C++ to realize a simple campus tour guide system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report