Of course.
Code:#include <string>
#include <cctype>
#include <vector>
#include <fstream>
#include <iostream>
using namespace std;
int main (){
string FileName;
cout << "Enter file name : ";
cin >> FileName;
ifstream file1(FileName.c_str());
ifstream file2 ("List of proper nouns.txt");
if (!file1){
cout <<"\nThere is no file, named --> " << FileName << " <-- in your folder.\n\n"
"What a loser! Give it up, you're never gonna make it! :-)\n\n";
system ("pause");
return(1);
}
ofstream TheCopy;
TheCopy.open ("Your_Uppercased_Proper_Nouns_Copy.srt",ios::app);
string str1;
string str2;
vector<string> myvector;
size_t pos = 0;
while (getline(file2, str2))
{
myvector.push_back(str2);
}
while (getline(file1, str1))
{
for ( int i = 0; i < myvector.size(); i++)
{
while ((pos = str1.find(myvector[i], pos)) != string::npos)
{
if ((str1[pos-3] != ' ' && str1[pos-2] != 'a' ) &&
(str1[pos-4] != ' ' && str1[pos-3] != 'a' && str1[pos-2] != 'n'))
{
str1[pos] = toupper (str1[pos]);
pos += str2.size();
}
pos += str2.size();
}
}
TheCopy << str1 << endl;
}
file1.close();
file2.close();
TheCopy.close();
return 0;
}