Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone implement the function and then TEST THAT FUNCTION IN A FULL PROGRAM

ID: 3715042 • Letter: C

Question

Can someone implement the function and then TEST THAT FUNCTION IN A FULL PROGRAM.

the program must be able to run on visual studio. C language

Exercise 8.6 In real Scrabble, there are some blank tiles that can be used as wild cards; that is, a blank tile can be used to represent any letter. Think of an algorithm for TestWordC) that deals with wild cards. Don't get bogged down in details of implementation like how to represent wild cards. Just describe the algorithm, using English, pseudocode, or C

Explanation / Answer

#include <stdio.h>

#include <stdbool.h>

int TestWord(char *wPatern, char *str)

{

if(*wPatern=='' && *str=='')// Checking if str is at the end

return 1;

if(*wPatern=='?' || *wPatern==*str) //is single character missing or matching

return TestWord(wPatern+1,str+1);

if(*wPatern=='*')

return TestWord(wPatern+1,str) || TestWord(wPatern,str+1); // Check if multiple character missing

return 0;

}

int main()

{

if(TestWord("f?rmc*","firmcodes")==1)

{

printf("Found Match");

}

else

{

printf("Not Matching");

}

return 0;

}