Question: Write in C, please Problem 2 (35 points): The file placelist.txt contains the place information (name, country, latitude and longitude). Write a C program that
Write in C, please
Problem 2 (35 points): The file placelist.txt contains the place information (name, country, latitude and longitude). Write a C program that
a) Reads places from a file called placelist.txt and stores it in an array of type place
b) Prints, on screen, places in the database that are NOT in USA.
c) Sorts the array of places in distance from Tucson city center and print the sorted array on screen. To do so, you will modify the void selection(int x[], int size) function that sorts ints given on the next page.





Tucson City Center
USA 32.225750 -110.950109
placelist.txt
Vancouver International Airport Canada 49.196691 -123.181512 Tucson International Airport USA 32.114510 -110.939227 University of Arizona USA 32.231885 -110.950109 Statue of Liberty USA 40.689249 -74.044500 Big Ben UK 51.500729 -0.124625 Forbidden City China 39.916345 116.397155 Sydney Opera House Australia -33.856784 151.215297 Ministro Pistarini International Airport Argentina -34.815004 -58.534828 Colosseo Italy 41.890210 12.492231 Golden Gate Bridge USA 37.819929 -122.478255
Problem 2 (35 points): The file placelist.txt contains the place information (name, country, latitude and longitude). Write a C program that a) Reads places from a file called placelist.txt and stores it in an array of type place b) Prints, on screen, places in the database that are NOT in USA. c) Sorts the array of places in distance from Tucson city center and print the sorted array on screen. To do so, you will modify the void selection(int x[], int size) function that sorts ints given on the next page. Ifyou hard-code the list of cities sorted by distance in your code, O point for this problem 1) Your program MUST use the following structure: typedef struct place_s f char name [100]; char country[30]; double latitude; double longitude; place; Note: the above structure can be modified (i.e., to include distance) so that it can be used with sorting
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
