Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USE c Language to solve this problem... Hints: #include #define NOP -1.0 .. .. //Complete your code Write a program to print the rail fare
USE c Language to solve this problem...
Hints:
#include
..
..
//Complete your code
Write a program to print the rail fare between two rail stations. The graph that connects these stations is shown in Figure 1. Use adjacency matrix to represent the graph. RM 5.40 1 0 RM 2.20 0 - Kota Damansara 1-Sentul 2-Pasar Seni 3- KL Sentral 4-Bandar Puteri 5-Kajang RM 4.50 RM 1.30 3 2 RM 4.60 RM 4.10 5 Figure 1 The program should a) Print the list of towns using a function called printStations [2 marks] b) Prompt user to key in an origin and destination station. [1 mark] Print the rail fare between the stations. If there are no direct route, print "No direct route" [7 marks) An example of the output is shown in Figure 2. Stations 0 Kota Damansara 1 Sentul 2 Pasar Sena 3 KL Sentral 4 Bandar Puteri 5 Kajang Origin: 0 Destination: 3 Kota Damansara to KL Sentral: RM 4.50 Figure 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started