Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Programming (Needs to be done with C Programming) Reference for functions in C: http://www.cplusplus.com/reference/clibrary/ Coding Assignment (100 points in total) Please copy the supplied

C Programming (Needs to be done with C Programming)
image text in transcribed
image text in transcribed
image text in transcribed
Reference for functions in C:
http://www.cplusplus.com/reference/clibrary/
Coding Assignment (100 points in total) Please copy the supplied code and test inputs by copy the following folder to your working directory. You should see two C program, and 6 input cases for the 3 tasks cp /home/rwang67/public/lab4/ Task 1(30 points) Compile and run the program analyze,c. Modify the program to replace the loop containing repeated getchar() calls with a single call to fgets(). Here is a quick tip on its usage fgets(text, MAX, stdin); fgets stands for "get string from file", and it stores the string read into text, reading up to a maximum number of MAX characters, from the file specified in the third argument, which in our case is the "standard input" or stdin (meaning keyboard, or a file if input is redirected using Once you make this change, however, you will no longer have the length of the string in length so you will have to use the C library function strlen() to compute the length of the string Note that the string read using fgets has a newline character at the end, and strlen includes this newline character in the length of the string, which is not what we want. So, adjust the string length accordingly Note that while there are several others ways to accomplish this exercise, you must do exactly as explained above, in particular: (i) use fgets() to read the line of input; and (ii) use strlen()to compute the length of the input line Call your program ex1.c. Compile it and run it on a few inputs of your choice. Also, run it on the sample inputs provided and save the output files. Reference for functions in C: http://www.cplusplus.com/reference/clibra

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

What do you mean by a COMPLETE communication?

Answered: 1 week ago

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Explain the procedure for valuation of shares.

Answered: 1 week ago

Question

Which months of this year 5 Mondays ?

Answered: 1 week ago

Question

Define Leap year?

Answered: 1 week ago