Program in C. Help please! Write some code in the main() function to accomplish the following tasks:  Read the supplied data from datafile city.dat  Build an adjacency matrix based on the city.dat datafile  Create an alphabetized list of cities for selection by the user  Display the cities from which to select using a number that your program assigns from the alphabetized list of cities that is dynamically created from your city.dat file. Example: Please select an origin city Enter a number associated with one of the cities below: Amsterdam --- 1 Belgrade --- 2 Bern --- 3 Genoa --- 4 Hamburg --- 5 Lisbon --- 6 Madrid --- 7 Having written code to extract data from the keyboard (stdin) in Lab 3, reuse that code to prompt the user to enter a number, verifying that the number entered is an integer and is between 0 and the maximum number of available cities in the list. You should ignore any invalid entries such as float values, letters, punctuation, whitespace, etc.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Program in C. Help please!

Write some code in the main() function to accomplish the following tasks:

 Read the supplied data from datafile city.dat

 Build an adjacency matrix based on the city.dat datafile

 Create an alphabetized list of cities for selection by the user

 Display the cities from which to select using a number that your program assigns from the alphabetized list of cities that is dynamically created from your city.dat file.

Example: Please select an origin city Enter a number associated with one of the cities below: Amsterdam --- 1 Belgrade --- 2 Bern --- 3 Genoa --- 4 Hamburg --- 5 Lisbon --- 6 Madrid --- 7

Having written code to extract data from the keyboard (stdin) in Lab 3, reuse that code to prompt the user to enter a number, verifying that the number entered is an integer and is between 0 and the maximum number of available cities in the list. You should ignore any invalid entries such as float values, letters, punctuation, whitespace, etc.

 Display the above list of cities and have the user select an origin city from the list

 Display the above list of cities, removing the city selected as the origin city, and have the user select a destination city from the list

 Apply Dijkstra's Algorithm to determine the optimal (shortest) path between the two selected cities

 Report three items on the screen: 1. the names of the two selected cities identified, such as: ORIGIN: Lisbon DESTINATION: Warsaw

2. the length of the optimal path, such as: LENGTH: 1629

3. the list of the cities visited along the optimal path, like:

PATH CITIES: Lisbon Madrid Genoa Trieste Vienna Warsaw

 Continue to ask for two cities to map until the user selects 0

1 Lisbon Madrid 339
2 Naples Rome 134
3 Hamburg Copenhagen 180
4 Hamburg Berlin 182
5 Berlin Warsaw 345
6 Amsterdam Hamburg 338
7 Amsterdam Brussels 164
8 Berlin Prague 219
9 Prague Warsaw 479
10 Prague Vienna 185
11 Munich Prague 174
12 Vienna Warsaw 464
13 Vienna Budapest 155
14 Warsaw Budapest 394
15 Budapest Belgrade 263
16 Vienna Belgrade 501
17 Budapest Trieste 384
18 Trieste Vienna 317
19 Trieste Belgrade 403
20 Munich Vienna 280
21 Munich Rome 582
22 Genoa Trieste 361
23 Genoa Rome 328
24 Trieste Rome 442
25 Paris Genoa 629
26 Genoa Bern 304
27 Genoa Brussels 740
28 Bern Brussels 497
29 Amsterdam Bern 558
30 Amsterdam Munich 526
31 Bern Munich 311
32 Bern Trieste 489
33 Bern Madrid 1104
34 Madrid Genoa 951
35 Madrid Paris 805
36 Paris Brussels 225
Transcribed Image Text:1 Lisbon Madrid 339 2 Naples Rome 134 3 Hamburg Copenhagen 180 4 Hamburg Berlin 182 5 Berlin Warsaw 345 6 Amsterdam Hamburg 338 7 Amsterdam Brussels 164 8 Berlin Prague 219 9 Prague Warsaw 479 10 Prague Vienna 185 11 Munich Prague 174 12 Vienna Warsaw 464 13 Vienna Budapest 155 14 Warsaw Budapest 394 15 Budapest Belgrade 263 16 Vienna Belgrade 501 17 Budapest Trieste 384 18 Trieste Vienna 317 19 Trieste Belgrade 403 20 Munich Vienna 280 21 Munich Rome 582 22 Genoa Trieste 361 23 Genoa Rome 328 24 Trieste Rome 442 25 Paris Genoa 629 26 Genoa Bern 304 27 Genoa Brussels 740 28 Bern Brussels 497 29 Amsterdam Bern 558 30 Amsterdam Munich 526 31 Bern Munich 311 32 Bern Trieste 489 33 Bern Madrid 1104 34 Madrid Genoa 951 35 Madrid Paris 805 36 Paris Brussels 225
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY