Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char* argv[])
- {
- string path = "C:\\log1.txt";
- ifstream file;
- file.open(path);
- assert(file);
- ofstream file2("output.txt");
- string line;
- string total;
- for(int i=0;file.good();i++)
- {
- getline(file,line);
- total +=line;
- regex rx1(";");
- line = regex_replace(line, rx1, "__SEMICOLON__");
- regex rx2("private|public|class|include|namespace|string|iostream");
- line = regex_replace(line, rx2, "_C++_KEYWORD__");
- regex rx3("{|(");
- line = regex_replace(line, rx3, "__OPENING_BRACE__");
- regex rx4("}|)");
- line = regex_replace(line, rx4, "__CLOSING_BRACE__");
- file2<<i<<" "<<line<<endl;
- }
- int numWords=0;
- for(int i=0;i<total.length();i++)
- {
- if(total[i]==' ')
- numWords++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement