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

Write a function CheckPhrase to check spelling in a phrase. It should have the f

ID: 3727787 • Letter: W

Question

Write a function CheckPhrase to check spelling in a phrase. It should have the following parameters: . a string phrase, - a string outputFile .an array of strings correctWords Size of the array correctWords a 2D array of strings misspelledWords 12) the number of rows in the misspelledWords array. · You should do the following with phrase: 1. Separate the phrase into words 2. Call CheckWord on each word to check the spelling of the word and construct a corrected phrase. o Note: the resulting phrase will contain "unknown" if any words are not found in the arrays 3. Open the outputFile in append mode. 4. Append the corrected phrase to the output file. NOTE: Your outputfile should end with an extra line (A new line character). This is to ensure that each time you add lines to it, it starts from a new line. Edge Conditions . Your program should print 'Phrase is empty. Nothing to write in file." to the console if your phrase is empty. Note: Your program should not write anything to the output file in this case. Your program should print "Unable to create/ access output file.* if you're not able to access your output file. . Example If I call CheckPhrase with the phrase "chicken fish and bubbls the arrays specified in the previous examples, and this output fille: outputFile.txt (Before function call) ocean bubbles unknown pear bubbles fish unknown unknown fish then I would expect the output file to look like this after the function call. outputFile.txt (After function call)

Explanation / Answer

# include <stdio.h>

void checkphrase ( char string[], int *px)

{
int i;
printf(" PHRASE ENTERED IS %s " , string[i]);
/* Prints the Phrase entered */

/* Start for loop to compare letters to the morse code equivalent */

for( i=0; i <= 30; i++)
{
px = string[i]; // pointer points the string value
a = px; // int a is assgined the value of px to be compared to morsecode
findmorse() // calls function to compare morsecode
}
return 0; // returns to main

}

void findmorse (int a)
/* originoally had a = the aphpabet but converted to binary */
{
if (a == 01000001)
Printf(" • — ");
else if (a == 01000010)
Printf(" — • • • ");
else if (a == 01000011)
Printf(" — • — • ");
else if (a == 01000100)
Printf(" — • • ");
else if (a == 01000101)
Printf(" • ");
else if (a == 01000110)
Printf(" • • — • ");
else if (a == 01000111)
Printf(" — — • ");
else if (a == 01001000)
Printf(" • • • • ");
else if (a == 01001001)
Printf(" • • ");
else if (a == 01001010)
Printf(" • — — — ");
else if (a == 01001011)
Printf(" — • — ");
else if (a == 01001100)
Printf(" • — • • ");
else if (a == 01001101)
Printf(" — — ");
else if (a == 01001110)
Printf(" — • ");
else if (a == 01001111)
Printf(" — — — ");
else if (a == 01010000)
Printf(" • — — • ");
else if (a == 01010001)
Printf(" — — • — ");
else if (a == 01010010)
Printf(" • — • ");
else if (a == 01010011)
Printf(" • • • ");
else if (a == 01010100)
Printf(" — ");
else if (a == 01010101)
Printf(" • • — ");
else if (a == 01010110)
Printf(" • • • — ");
else if (a == 01010111)
Printf(" • -- ");
else if (a == 01011000)
Printf(" -• • - ");  
else if (a == 01011001)
Printf(" -• -- ");
else if (a == 01011010)
Printf(" --• • ");

/* Numbers */

else if (a == 1)
Printf(" · – – – – ");
else if (a == 2)
Printf(" · · – – – ");
else if (a == 3)
Printf(" · · · – – ");
else if (a == 4)
Printf(" · · · · – ");
else if (a == 5)
Printf(" · · · · · ");
else if (a == 6)
Printf(" – · · · · ");
else if (a == 7)
Printf(" – – · · · ");
else if (a == 8)
Printf(" – – – · · ");   
else if (a == 9)
Printf(" – – – – · ");
else if (a == 0)
Printf(" – – – – – ");

/* return to check phrase */

return string[};
}

int main() // main function

{
printf("PLEASE ENTER A PHRASE UNDER 30 CHARACTERS ");
scanf(" %s " , string[]);
checkphrase () // takes string to the checkphrase function
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote