Question: In C language write a program that will begin with the following command: a.out k1 k2 k3 k4 k5 In_file Out_file a.out is the executable

In C language write a program that will begin with the following command: a.out k1 k2 k3 k4 k5 In_file Out_file a.out is the executable file; In_file and Out_file are the names of the input and output files; the five arguments in the middle are all integers:

k1: the number of weeks to run the simulation;

k2: the percentage of infected people initially in the population

; k3: the percentage of population who wear face masks; k4: the percentage of population who are vaccinated

; k5: the probability that an infected person will be quarantined. 2.

And your program should initially verify the followings for the correctness of the command line arguments:

a. The number of command line arguments must be 8, including a.out

b. k1 is between 1 and 52, k2 k3 k4 and k5 are all between 0 and 100.

c. Your program must be able to open files In_file and Out_file for read and write. If there is any violation, your program should print out the corresponding error message and terminate. If there are more than one errors in the command line, printing out any one of them will be ok.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!