Question: Command Line Words Write a program called that takes in comand line arguments and prints out the total number of words that appear in them.command_line_words

Command Line Words Write a program called that takes in comand line arguments and prints out the total number of words that appear in them.command_line_words . c A word is defined as any collection of characters that do not contain a space. For example, "Today I Slept" contains 3 words definition. However, the twist with this exercise is that we are going to input command line arguments in a special way such that a singl contain spaces. So far, we have seen the use of command line arguments as such: $ . /program Here are my arguments We know that in this case is 5. We can also visualise the layout of like so:argcargv However, there is actually a way to group words together into a single argument! This can be done by surrounding these words quotes. If we adjust the above example to instead be: $ . /program Here "are my" arguments Then will now be 4. We can also visualise the new layout of like so:argcargv It is important to see here that the number of command line arguments changes, but the number of words stays the same (4, exc !./program Here are some examples for how your program should work (Note that we ignore in all outputs):. /command_line_words $ ./ command_line_words Here "are my" arguments There are 3 command line arguments (Excluding program) ! There were 4 total words! $ ./ command_line_words "All words in one argument" There are 1 command line arguments (Excluding program) ! There were 5 total words! $ ./ command_line_words "Mixture of" "words" in "Command line arguments" There are 4 command line arguments (Excluding program) ! There were 7 total words! $ . / command_line_words "Empty Arguments" "" " "End" There are 4 command line arguments (Excluding program) There were 3 total words! Hints, Notes and Assumptions . You will only be given letters, quotes and spaces as input . Autotests will use single quotes to group arguments. There is no fundamental difference in this exercise between using single and double quotes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
