WHY IS THIS PROGRAM SO STINKIN SLOW?? I rote it today it reads throught the entire file..about 5 megs and it is super slow. I have heard c++ programmers for years say that c++ is the way to go if you want your programs to be fast. Well i wrote a more complex program in vb.net it runs in windows this below code runs in a console so it is less complex and my vb.net(more complex) will smoke this simple little program below.

Can anyone tell me why? the CaseConverter is just a seperate thing to convert the string to lower case so it does not make a big difference. Oh yea i am running the below code on a pentium 4 and the vb.net code on a very much slower pentium 2 and it still smokes the below code.

Thanks for any help.



// Included Stuff & Other Stuff//
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "caseconverter.cpp"

using namespace std;

typedef vector<string> StringArray;

//Main Function: //

int
main(void)
{

ifstream fin;
string Buffer;
string sString;
string addStr;
StringArray Results;
StringArray::iterator sIT;
CaseConverter Converter;
int Found = 0;

// Open file to be read

fin.open("bible(KJV).txt");

cout << "Please enter a search string: ";
getline(cin,sString,'\n');
Converter.cConverter(&sString);
cout << "Searching for: " << sString;


// Check to see if it opened

if(fin.fail())
{
cout << "\nError Opening File\n"; //if the file is not found then display error and exit
return 0;
}

// Search for the string

while(getline(fin,Buffer))
{
Converter.cConverter(&Buffer);

if(Buffer.find(sString) != -1)
{
Results.push_back(Buffer);

Found += 1;
}
}

// Close file

fin.close();

// Display info about search

cout << "\n There were " << Found << " verses that contained " << sString << "\n";


return 0;
}