Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ICS 103-172 Lab Test 4 Section 62 Student Student | 2 osu (296? ID Name Write a complete C program that reads from a file

image text in transcribed
ICS 103-172 Lab Test 4 Section 62 Student Student | 2 osu (296? ID Name Write a complete C program that reads from a file named Population.txt and writes into a file named Summary.txt. The structure of the Population.txt - which contains unknown number of countries - is as follows: Each line contains three values: The first letter of a country, the population size of the year 2010, and population size of the year 2015. The program must contain two functions: the main and the ComputeStatisties. In the main function, prompt and read a character from the user. Then, it calls the function ComputeStatistics with this letter as an argument. In addition, the main function writes() the country letter, (ii) the population difference of the two years and (ii) the percentage of the population growth into the file summary.txt. The function Compute Statistics receives the letter and computes the difference between the two population values and the percentage of the population growth of the target country. The difference and the population growth percentage are computed by the following formulas: PopulationDiff = NewPopulation-old Population PopulationDiff PopulationGrowtholdPopulation 100 Very important notes: (1) Declare Compute Statistics function that returns more than one result. (2) Using array is not allowed. (3) Manipulating files should be done using loop. output file: Summary.txt Population differences of country K is 2500000 Population growth percentage is 83.33% Input file: Population.tt 8000000 J 5000000 ? 1300000 3600000 K 3000000 5500000 s 8000000 12000000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions

Question

What aspects would it be impossible to capture?

Answered: 1 week ago

Question

Enhance your words with effective presentation aids

Answered: 1 week ago