finally i write a spelling checker program using c++ string..but cant compile

finally i write a spelling checker program using c++ string..but cant compile..
actualy i got 30 errors but i manage to reduce it until 8. But then i cant figure out already what is wrong in my coding. Plz help me..


#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;
}

1.) Fix the errors
2.) ????
3.) PROFIT!
closed account (z05DSL3A)
memoc3, please use code tags to post code, telling us what the errors are also helps. Basicaly the more information you can give us the quicker you will get help[1].

[code]
Your code
[/code]

[1] http://www.cplusplus.com/forum/beginner/1/
Last edited on
Topic archived. No new replies allowed.