spelling checker..

helo all.. here i have write a complete coding for the spelling checker prog. its a assignment. but its still cant compiled. i check and everything just fine for me. realy cant figure out wat is wrong.. can anyone help me plz. hv to pass up tomorow..

#include <iostream>
#include <conio>
#include <fstream>
#include <string>
int countFactorial (int ) ;
void chgRefChar (string* const, string* const, int ) ;
void scramLetters (string*, int );

#include <stdlib>
#include <stdio>


int main()
{
const int SIZE = 20;
string ch, refer;
int length1, factorial;
string test;


ifstream inFile;
inFile.open("dictionary.txt");
if(inFile.fail())
{
cout << "Error opening file";
cout << "\nPress anykey to exit";
return 0;
}
cout << "Enter a word: ";
cin >> ch;

length1 = ch.length();
factorial = countFactorial (length1);
cout << "Factorial: " << factorial << endl;
getch();

int iteratFirstLetter = 0;
int x = 0;
char buffer;
int iteratLetters = 0;
refer.assign(ch);
int count = 0;

while(count < factorial)
{
cout << "Length: " << length1 << endl;
cout << "Word you entered: " << ch << endl;
iteratLetters = 0;
iteratFirstLetter++;

while ( iteratLetters < (factorial / length1) )
{
int i = 0 ;

for (;i < 2 ; i++, count++, iteratLetters++)
{
scramLetters (ch , i);
x = 1;

while(inFile.good())
{
inFile >> test;
cout << "Searching... " << endl;
x = ch.compare(test);

if ( x == 0 )
{
if ( !refer.compare(test))
cout << "Word is spelled correctly";

else
{
cout << "Suggestion: " << endl;
cout << test ;
cout << "\nPress any key to continue searching";
getch();
}
}

}

inFile.close() ;
inFile.open("dictionary.txt") ;
}

}

chgRefChar (ch, refer, iteratFirstLetter );

}
cout << "\n\nDone searching";
cout << "\nPress any key to quit";
getch();
return 0;
}


int countFactorial (int n)
{
int combine = 0, multiplier = 0;
int count = 1;
multiplier = n * (n - count);

while ( count < n )
{
count++;

combine = multiplier * ( n - count );
multiplier = combine ;
if ( count == (n - 1))
count++;
}
return combine;
}


void chgRefChar (string* const pCh, string* const pRefer, int y )
{
static char bufferChar;

pCh.assign(pRefer);
bufferChar = pCh[0];
pCh[0] = pRefer[y];
pCh[y] = bufferChar;

}

void scramLetters (string* pCh, int i)
{
static string buffer;
buffer = pCh[i + 1];
pCh[i + 1] = pCh[i + 2];
pCh[i + 2] = buffer;
}
Last edited on
Well, obviously, if it doesn't compile then it's not "fine".
1. Edit your post and paste your code again, this time surrounding it with [code][/code] tags.
2. Post the compiler errors.
Topic archived. No new replies allowed.