I need to create a function template that accepts two parameters representing tw
ID: 3545984 • Letter: I
Question
I need to create a function template that accepts two parameters representing two distances from a given point. The function returns the total distance as an integer.
I also need to create two classes with fields for a city or state. The main function ask me to write the name of the city or state, the distance between them and the calcDistance() funtion calculates adds the distances and displays the results.
The actual problem I was gives sounds a lot more complicated than this, so I shorten it to make a little more sence. I I could just get a little help with the initiation, I could do the rest. Thanks for any help
Explanation / Answer
assuming you have the names of the cities
under main
{
cout << "citybob ";
cout << "citytrisha ";
//call upon the function
calcdistance(5,4):
}
function calcdistance(int city1distance, int city2distance)
{
int temp = city1distance+city2distance;
cout << temp;
// will show 9 in this example
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.