Write a C function called secondWord that has the prototype char* secondWord(char* inputString, char* outputString); Your function
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 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.
Discovering Advanced Algebra An Investigative Approach
ISBN: 978-1559539845
1st edition
Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke