|
|||
High-Density Countries
Write a program that reads data of countries from the input file name;area;population[;population]… name is a string with no more than 30 characters, containing no semicolons, area and population are positive integers. The total population of the country is the sum of the population values in the line. The file consists of up to 200 lines, each at most 1000 characters long. The program should write to the standard output the name, area, and total population of those countries whose population density (population to area ratio) exceeds the real value given in the first command line argument of the program, one country per line. Two consecutive data values in a line should be separated by a comma. Sort the output in descending order of population densities. Countries with the same population density should be sorted in ascending order of country names.
Hint: see Sample Command Line Arguments
Sample
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |