/************************************************************************/

//  Programming #2C

//

//  List below are function prototypes of new functions

//                              to be implemented in model.cpp for Programming #2C

//

/************************************************************************/

 

 

//Either this version

void typeOneArticle

(const char * corruptedMessageFile, const char * sourceArticle, bool trace = false);

/************************************************************************/

// corruptedMessageFile and sourceArticle are two character arrays to store the names of two files

// trace is a boolean flag: 

//      output traces to the screen for your debugging purpose when it is true ; otherwise keep silent.

//

//Open the file whose name is stored in sourceArticle as a file for input.

//Open the file whose name is stored in corruptedMessageFile as a file for output.

//

//Read the words one by one from the file sourceArticle:

//For each word,

//              (i) simulate how the word may be typed according

//              to the spelling model and the keyboard model, and then

//              (ii) store the resulting word into the file corruptedMessageFile.

/************************************************************************/

 

//Alternatively, you may simply implement a variant using string objects for file names instead  this version instead

void typeOneArticle

(string corruptedMessageFile, string sourceArticle, bool trace = false);

/************************************************************************/

// corruptedMessageFile and sourceArticle are two strings to store the names of two files

// trace is a boolean flag: 

//      output traces to the screen for your debugging purpose when it is true ; otherwise keep silent.

//

//Open the file whose name is stored in sourceArticle as a file for input.

//Open the file whose name is stored in corruptedMessageFile as a file for output.

//

//Read the words one by one from the file sourceArticle:

//For each word,

//              (i) simulate how the word may be typed according

//              to the spelling model and the keyboard model, and then

//              (ii) store the resulting word into the file corruptedMessageFile.

/************************************************************************/

 

 

 

/************************************************************************/

// Also see below how option B in the main function in demo.cpp

//                              call typeOneArticle to simulate the typing behavior

/************************************************************************/

 

/*

 

int main()

{

                ...

                ...

 

                case 'B': case 'b'://

                                {

                                                displayParametersKbModel();

                                                displayParametersSpellingModel();

 

                                                //*********************************************

                                                //Try to simulate typing the Biola vision statements, twice

                                                //*********************************************

                                                cout << endl << "[Now typing the whole Biola vision article twice]:" << endl;

                                                cout << endl << "Press any key to continue" << endl;

                                                _getch();

 

                                                cout << "[_1_CorruptedBiolaVision1.txt]" << endl;

                                                typeOneArticle("1_CorruptedBiolaVision.txt", "BiolaVision.txt");

 

                                                cout << endl << "[Now typing the whole Biola vision article into]:" << endl;

                                                cout << "[_2_CorruptedBiolaVision1.txt]" << endl;

                                                typeOneArticle("2_CorruptedBiolaVision.txt", "BiolaVision.txt");

 

                                }

                                endOfService("[Simulation of typing behavior.]");

 

                                ....

*/