Need help ,little bit support

You are expected to implement a simple program to find nearest unit (hospital, university, or pharmacy) with following scenario:
The program stores information of 20 units (buildings). These buildings are "University" , "Pharmacy", and "Hospital". The program will ask the user to enter the type and location (coordinates) of each building. Then, the user will enter his/her own location. The program will find the nearest buildings.
Minimum Criteria:
You are expected to write C++ console application.
 You need to create 1 char and 2 double arrays to keep the type and location as x and y coordinates of the units
 You need to take building information from the user as type of char.
o For Hospital, store H in char array.
o For University store U in char array.
o For Pharmacy store P in char array.
 You need to take coordinates from the user as type of double.
o For x coordinate, store input into first double array.
o For y coordinate, store input into second double array.
 Create a menu, showing the locations of each building.

until here I've written project.However I faced some proplem those three sentences below. How can I write c++ codes?

 Find the nearest building as type of user-choice, ie. 'H','U' or 'P'. Use Euclidean distance to compute the distances between the buildings and user's location.
 Find the nearest 3 buildings for user selection.
 Find the nearest buildings for each of them.

Thanks for everyone!


For the first one, the user will enter one of 'H', 'U', or 'P'. Based upon that, use the Euclidean distance formula of each coordinate of the corresponding choice the user has entered, and the user's position.

For the second one, repeat the first one three times.

For the last one:
For each type of 'H', 'U' and 'P'
Compare the coordinates with the user's coordinates.
Repeat three times.
Topic archived. No new replies allowed.