Question: Write a program in C: The program must compile with both -Wall and -Werror options enabled Submit only the files requested Use doubles to store

Write a program in C:

  • The program must compile with both -Wall and -Werror options enabled
  • Submit only the files requested
  • Use doubles to store real numbers
  • Print all doubles to 2 decimal points unless stated otherwise

Restrictions:

  • No global variables may be used
  • Your main function may only declare variables and call other functions

Description:

Write a program that counts the number of words contained within a file

Additional Details:

  • The name of the file will be passed on the command line
  • A word is considered to be 1 or more consecutive whitespace characters
  • A character is considered whitespace if is space would return true if passed that character as an argument

Input:

  • Input will always be valid

Hints:

  • The test case files are available under the starter code

Examples:

User input has been bolded to help you differentiate what is user input and what is program output.

Example 1

Assume that the file fun.txt contains the following:

Computer sciences classes are great!

Even though I spend all my time doing homework :(

./wcount fun.txt

There are 15 word(s).

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!