Represent the real numbers

Assignment Help C/C++ Programming
Reference no: EM13937065

Assume you are given a set of N < 10 cities with pairwise distances between them represented as real numbers. A traveler starts from city #1 and wants to visit all other cities just once and return back to the origin. Assume there is a direct airline between any two of these N cities. Your task is to design a C++ program that will find an optimal route for the traveler. That is, the program should return a route of minimum total length. Assuming that the traveler always starts from city 1 the output of the program for N = 4 should be of the form
1 -> 2 -> 4 -> 3 : 226.6

where the last number is the minimum total distance.

Create a file dist.dat for storing the pairwise distances represented as an NxN table of numbers. The number at the intersection of the i-th column and j-th row is the distance from city i to city j. So the table is symmetric; that is, the number at the intersection of row i and column j is the same as the one at the intersection of column i and row j. Note that the number N of cities is not presented explicitly in the file, your program has to figure it out. Your program should read the data from the file by using the input redirection.

Example of such file for N = 4:

56.78 11.80 79.34 78.23
11.80 16.26 65.23 45.19
79.34 65.23 63.29 90.27
78.23 45.19 90.27 87.35

Create your own file for at least 7 cities.
Your program should work for any N in the range [3..10]

Reference no: EM13937065

Questions Cloud

Exploit be demonstrated safely in-class : Task: You are required to create and deliver a presentation providing an analysis of an existing software exploit (therefore you are not required to craft a new, unknown exploit yourself).
Ethical philosophy of an organisation : The ethical philosophy of an organisation is usually embedded into the culture of the organisation by its leaders. Describe what ‘leadership by example' is and how it helps create an ethical culture.
What is the hormone that is tested for in pregnancy : Pregnancy can be detected several days post-implantation, based on a hormone level test. What is the hormone that is tested for in pregnancy, and what is its role? How is the test administered, and who may perform it?
Future career in health care : Consider your future career in health care. What opportunities will you have to promote health enhancing behaviors and discourage health compromising behaviors?
Represent the real numbers : Assume you are given a set of N
Socioeconomic status affects health : How race, gender and socioeconomic status affects health
Explain the importance of sexual reproduction : As you can see in these three life cycles, those of higher organisms tend to emphasize the diploid stages more than the haploid stages. Explain why there has been a trend toward diploidy among higher organisms; what are the advantages of being dip..
What are the mix of product you wish to concentrate on : 1. What are the mix of product you wish to concentrate on? -how is your product similar/different to that of competitors
Evaluate its employees four times a year at the end of year : The data will be validated and saved to an output file,"datainput" . this program will use five arrays to grater manupliate and store the data.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd