Question: Write a C function called secondWord that has the prototype char* secondWord(char* inputString, char* outputString); Your function should do the following: Prompt the user to

Write a C function called secondWord that has the prototype

char* secondWord(char* inputString, char* outputString);

Your function should do the following:

Prompt the user to enter three to five words seperated by spaces or tabs

Finds the second word (separated by spaces or tabs in inputString)

Copies the second word into outputString

Returns a pointer to outputString

The data inside inputString is not changed by this function

It can be assumed that inputString is less than 150 characters

It can be assumed that outputString is able to support the length of the second word

If inputString contains no second word, the function should put a NULL into outputString and return a NULL

For an inputString of “One Two Three Three Four” the outputString should be:

“Two”

For an inputString of “OneTwoThreeThreeFour” the outputString should be:

NULL

Write a C program in Code::Blocks to test your secondWord function from 3 (part 3 should be a function inside part 4’s completed code)

This program should create at least 10 use cases for the function that tests its behavior under different input conditions. These use cases are hard coded (no user input). Your code should be able to test any version of the secondWord function (it should be able to test another student’s secondWord function to confirm it operates correctly).

Test cases must include inputs with only 1 word, 2 words, 3 words, use of tabs, use of spaces, uses of tabs and spaces, capital letters, numbers, punctuations, appropriate combinations of test input.

The program should have a known expected output for each example and test the output to see if the output matches this expected output.

The program will output to the terminal and a txt file

The program will output information about what is being tested (secondWord)

The program will output “Function Test Case #” followed by the number of the test case, then output “Input: ” followed by the input, “Expected Output:” followed by the expected output, and “Output: “ followed by the output for each case. The program will print out a “PASS” or a “FAIL” after each output line. Output can be formatted on separate lines as shown below to make things easy to read.

The program will print out a “PASS” or “FAIL” at the end of the output for the whole function test. A FAIL is outputted if any individual test fails.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem youll need to break it down into two main parts creating the secondWord function and then writing a program to test this function with several predefined test cases Below is a de... View full answer

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

Document Format (2 attachments)

PDF file Icon

6095da653b18c_26321.pdf

180 KBs PDF File

Word file Icon

6095da653b18c_26321.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!