To create a class

#include<iostream>
#include <string>
#include <queue>
#include <fstream>

using namespace std;

int main() {
string f1,f2, s, s1;
queue<char> q;
cout << "vv.file 1,2:";
cin >> f1 >> f2;
ifstream in;
ifstream iin;
in.open (f1.c_str());
in>>s1;
in.close();
iin.open (f2.c_str());
if (!in) {
cerr << "Couldn't open input file, workload empty" << endl;
return 0;
}


while (1) {
getline(iin, s);
//iin>>s;
for (int i = 0; i < s1.length(); i++){
int w = s.find(s1[i]);
if (w != -1){
q.push(s1[i]);
}
}
if (in.eof())
break;

}
cout<<"***********\n";
while (!q.empty()){
cout<<q.front()<<" ";
q.pop();
}
cout<<endl;
return 0;
}
Topic archived. No new replies allowed.