I do not know the original language. It is a text file. It looks like fortran.
But I need to convert it to c++ code using a c++ program. Content of text file won't be changed.
Please see my code below. Finally I got some hope that I can make it working, Thanks a lot in advance.
<pre><pre lang="xml">#include <iostream>
#include <fstream>
#include <sstream>
#include <Vector>
#include<algorithm>
using namespace std;
void readfile(istream &input, vector<vector<string> > &output)
{
string line;
while( getline(input, line) )
{
istringstream Stream(line);
vector<string> words;
string Element;
while( getline(Stream, Element, ';') )
{
words.push_back(Element);
}
output.push_back(words);
}
}
int main()
{
ofstream myfile;
string a;
string str;
fstream file("final.txt", ios::in);
myfile.open ("output.txt");
if(!file.is_open())
{
cout << "File not found!\n";
return 1;
}
typedef vector< vector<string> > myV;
myV data;
readfile(file,data);
for(myV::iterator i = data.begin(); i != data.end(); ++i)
{
for(vector<string>::iterator j = i->begin(); j != i->end(); ++j)
{
a=*j;
if (find(i->begin(),i->end(), "Program abc13") != i->end()) myfile <<' '<<";";
{
}
}
}
system("pause");
file.close();
myfile.close();
}