Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is everything what more do you need? Write a C program named countC.c taking input text file as arguments and count the characters for

image text in transcribed

This is everything what more do you need?

Write a C program named "countC.c" taking input text file as arguments and count the characters for that text file according to the following requirements. (If no text file is given, countC will read the input from default text file "test.txt") You need to use fork to duplicate the processes. The parent process needs to output the most frequent letter and display how many times that letter appears. And please create n child processes (n>-3) and assign each process a task according to the indexi is from 0 to n-1 but NOT PID). If i%3--0, it should output the number of digits in the text file. If 1963-=1, it should output the number of letters in the text file(IGNORE CASE). If 1963-=2, it should output the number of white spaces in the text file. (For details, please refer to the example attached) Below are sample runs of countC.c (assuming countc is the generated executable file): Scat test.tx This is a list of courses. CSC 1010 COMPUTERS & APPLICATIONS S./countC Most frequent letter is 's', it appeared 8 times 0-Number of digit-4 2--Number of space 12 1-Number of letters 44 Notes: 3 child processes are created in this example, and '0', '1, '2' are the indexes of the processes. n counting the letters. Try to create 10 processes and see what is the output. In your output, the order of those indexes may be different from this example. Write a C program named "countC.c" taking input text file as arguments and count the characters for that text file according to the following requirements. (If no text file is given, countC will read the input from default text file "test.txt") You need to use fork to duplicate the processes. The parent process needs to output the most frequent letter and display how many times that letter appears. And please create n child processes (n>-3) and assign each process a task according to the indexi is from 0 to n-1 but NOT PID). If i%3--0, it should output the number of digits in the text file. If 1963-=1, it should output the number of letters in the text file(IGNORE CASE). If 1963-=2, it should output the number of white spaces in the text file. (For details, please refer to the example attached) Below are sample runs of countC.c (assuming countc is the generated executable file): Scat test.tx This is a list of courses. CSC 1010 COMPUTERS & APPLICATIONS S./countC Most frequent letter is 's', it appeared 8 times 0-Number of digit-4 2--Number of space 12 1-Number of letters 44 Notes: 3 child processes are created in this example, and '0', '1, '2' are the indexes of the processes. n counting the letters. Try to create 10 processes and see what is the output. In your output, the order of those indexes may be different from this example

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_2

Step: 3

blur-text-image_3

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

What do you think it means to be healthy?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago