Write a program that implements a simple spell checker

Assignment Help Basic Computer Science
Reference no: EM13307213

Write a program that implements a simple spell checker in C++. The spell checker should work as follows: prompt the user to enter a file name to spell check, and then the program will parse the file and check if there are any tokens that are not in the dictionary. Any words that are not found in the dictionary will be printed on the screen. Note that you do not need to worry about sorting words or prompting the user for corrections.

The program will be tested with two .txt files. One will be random sentences (to be spell checked) and the other will be the dictionary.

This program MUST be written using functions and arrays.

The program MUST and can ONLY contain the following function definitions and layout:

/**************************************************************
* This function takes in a filename and spells check it *
* @param file an input file stream (i.e. bonk.txt) *
***************************************************************/
void spell(string filename)
{
// function body
}

/**************************************************************
* This function takes a word from input file stream (i.e. *
* bonk.txt) and removes punctuation marks. Then, the function *
* updates the word in the caller argument (if necessary) *
* @param word a string that contains a word to be filtered *
**************************************************************/
void wordFilter(string& word)
{
// function body
}

/**************************************************************
* This function returns true if a word in input file stream *
* (i.e. bonk.txt) is in the dictionary, false otherwise. *
* @param word a string that contains a word to be checked *
* @return the Boolean status of the word (i.e. true or false) *
**************************************************************/
bool inDictionary(string word, string dictionary[])
{
// function body
}

/**************************************************************
* This is the main function of the program. *
* @return a value to terminate the program successfully *
**************************************************************/
int main()
{
// Prompt the user to enter a file to be spell checked
spell(filename);
return 0;
}

 

Reference no: EM13307213

Questions Cloud

How long would it take to complete one orbit : Suppose the shuttle increases its speed so that it has a length of 36.1 m when viewed by a stationary observer. How long would it take to complete one orbit
Determine what is the uniform deterministic arrival rate : ferryboat queuing lane holds 40 vehicles. If vehicles are processed (tolls collected) at a uniform deterministic rate of 5 vehicles per minute and processing begins when the lane reaches capacity
How many strings of ten uppercase english letters are there : How many strings of ten uppercase English letters are there
Determine the amplitude of this oscillating force : You are at a rock concert, and the sound intensity reaches levels as high as 120 dB. Calculate the amplitude of this oscillating force
Write a program that implements a simple spell checker : The program will be tested with two .txt files. One will be random sentences (to be spell checked) and the other will be the dictionary.
Hi-v produces three types of canned juice drink : Hi-V produces three types of canned juice drinks, A, B and C, using fresh strawberries, grapes, and apples.
Chemical process-evaluated and measurable property data : A chemical process is being evaluated and measurable property data is available for P, V, T, CP, and CV, and there is sufficient data to calculate their derivatives. Data is also available to calculate the value of entropy (S).
Create a monthly claim status summary report : What data validation check would the clinic need for the new patient data entry screen? Write a brief memo with your recommendations.
A 150-foot-long cable of diameter : A 150-foot-long cable of diameter 5 inches is submerged in seawater

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Assume that the input to each statement is the same

Assume that the input to each statement is the same: 5 28 36 a. cin >> x >> y >> ch; b. cin >> ch >> x >> y; c. cin >> x >> ch >> y; d. cin >> x >> y; cin.get(ch);

  Write a unit test of minmax in a main function

Write a function that computes the minimum and maximum of two integer variables and returns them through call-by-refernce parameters. It should have the following prototype: int minmax(int a, int b, int * min, int * max); Write a unit test of minm..

  Automated emails from google apps spreadsheet ?

How to send automated emails from google apps spreadsheet ?

  Write a few lines of code to create a timer in java

Write a few lines of code to create a timer in Java which fires an ActionEvent every 150 msec. Assume the existence of a TimerEventHandler class which needs to respond to timer events.

  Explain boolean formula is minimal

Boolean formula is minimal if there is no shorter Boolean formula which is equivalent to . Let MIN-FORMULA = { | is a minimal formula }. (a) Show that MIN-FORMULA (b) PSPACE.

  Convert the decimal integer

Convert the decimal integer -24 to 16 bit and 32 bit two's complement hexadecimal representation. show your calculations.

  Use a loop to traverse each character in the input string

Write a program in the file freq.cpp which reads a string from the user and computes the frequency of each letter that appears in the string.

  Generate an array of 20 random integers from 0 to 9

generate an array of 20 random integers from 0 to 9. Search for the first occurrence, if any, of the number 7, and report its position in the array.

  Calculate the net profit for all the products

Given the list of all the product prices and wholesale prices as well as a list of all the items sold for each product calculate the net profit for all the products.

  You enable completeonly specific input element true or false

You can enable auto complete only for specific input element. True or False

  Which method would be efficient for planning proactive

Process-centered review of object oriented software development methodologies, ACM Computing Surveys (CSUR), Volume 40 Issue 1, February 2008, Raman Ramsin, and Richard F. Paige.

  Describing equivalence relation

Let X = Z × (Z {0}). Define the relation  on X by (x, y)  (z, t) ↔ xt = yz for every (x, y), (z, t) ∈ X. Show that this is an equivalence relation on X.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd