Basic C++ Project 2

All the details are provided here:

[url removed, login to view]


There was an error in the description of the find function for assignment 4 (part 6). The original specification stated that the function should have a single string parameter. It should also have a parameter of the vector <City> to be searched.

The paragraph discussing this should (and now does) read:

To find the city you should write a function that searches a vector of cities for a city. T he function should have two parameters, a string representing the name of the city and the vector of cities to be searched . The function should return the index of the city, or -1 if the search is unsuccessful.


A rather strange situation that may cause an error can occur when calculating the distance between two cities (actually the distance between a city and itself). This error occurs when the acos() function receives an input greater than 1 (which it should not do). Without going into the details of exactly what is going on (it's to do with double arithmetic) the acos() function may get inappropriate input when you calculate the distance between a city and itself . So for example, calculating the distance between Vancouver and Vancouver! In these cases the distance should (obviously) be 0.

The easiest way of avoiding this error is to recognize that you are calculating the distance between a city and itself and just setting this distance to be 0, without using the spherical law of cosines formula. The simplest place to handle this is in the distance method of the City class. You can check to see if the latitude and the longitude of the calling object are the same as the parameter's latitude and longitude and then return 0.

Beceriler: C Programlama, C++ Programlama

Daha fazlasını görün: what is search string, what is in c programming, what is c# programming, what is c programming, what is a string in programming, what is a search string, what is an object in programming, what is a method in programming, what is a class in programming, vector vector string, vector string, vector in c, vector cplusplus, vector c, t$c, string vector, string search in c, string programming, string in c programming, string find c, string c programming, string cplusplus, search string in c, search string c, search c string

İşveren Hakkında:
( 8 değerlendirme ) BURNABY, Canada

Proje NO: #761559



Please check PMB, thanks.

1 gün içinde 30$ USD
(35 Değerlendirme)

8 freelancers are bidding on average $70 for this job


hi, plz check pmb.

in 2 gün içinde40$ USD
(25 Değerlendirme)

Hi, please read inbox message.

1 gün içinde 30$ USD
(13 Değerlendirme)

Hello! Please check PM for details. Thanks

1 gün içinde 50$ USD
(21 Değerlendirme)

Hi, am the one who did the last assignment for you. Am ready to do this like the other one.

1 gün içinde 40$ USD
(16 Değerlendirme)

hii see pmb please.

1 gün içinde 80$ USD
(5 Değerlendirme)

Hello, please read the PM

1 gün içinde 40$ USD
(1 Değerlendirme)

pleasure to work with u:)

in 7 gün içinde250$ USD
(0 Değerlendirme)