# How to write a c++ spell checker



## c1one (Feb 25, 2009)

Spell Checker

You will write a program that reads a file and performs a spell check on the file. You should specify the name of the file from the command line. 

Example

SpellCheck example.txt

Your program should read in a word list to use for the spell check. You can find a word list online using google or some other search engine. A suitable word list should list a single word per line in the file. You will read this word list into some data structure. An array can be used, but you will need to calculate the size of the array before running the program. You may also want to look into an alternate data structure like a vector or list or hash table. Once you read the dictionary into memory, you will read the file to be checked, and compare each word to the dictionary to determine if the word is in the list. If the word is not in the list, you should print the word and its location in the text. You do not need to offer suggestions for the incorrect word, just identify it as misspelled.

For instance, given the following input: 

I lvoe programming class. It is teh best! 

You program should output 

Misspelled Words

Location Word

2 lvoe 

7 teh

________________________________________________________________
so basically this is how far i got that i realized i was confused can some1 help me out but like keep the code as simple as possible(its a intro lvl class .), i need to hand this in very soon so a quick solution would be nice..

```
#include <iostream> 
#include <conio.h> 
#include <fstream> 
#include <cstring>


using namespace std; 
int main() 
{ 
Int item[5]
Int I
ifstream inFile;
inFile.open("C:\\temp\\datafile.txt");
Char str[30];
Cin.get(str,31);
```


----------



## Skie (Mar 15, 2003)

I'm sorry, but as per our rules, we do not help with school homework. If you have a specific problem that you're stuck on, we can help you, but we're not going to do your homework for you, nor are we going to help you with the entire asignment. 

The rules state the following: 



> You may not ask for assistance with homework including assignments, projects or book reports for school college or university


http://www.techsupportforum.com/rules.php


----------

