-
Notifications
You must be signed in to change notification settings - Fork 0
/
file.cpp
37 lines (33 loc) · 903 Bytes
/
file.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <fstream>
#include <cstddef>
using namespace std;
int main ()
{
string ch,a,input;
int check;
a=",";
fstream file,result,cleaned,final;
file.open("input.txt");
result.open("result.txt",ios::app);
cleaned.open("cleaned.txt",ios::app);
final.open("final.bat",ios::app);
cout<<"enter the choice : F,M,R,S"<<endl;
cin>>ch;
ch = "\"" + ch + "\"";
string line;
cout<<"what you want to append ??"<<endl;
cin>>input;
while(!file.eof())
{
getline(file,line);
check=line.find(ch);
if ( check!= std::string::npos)
{
result << line+"\n";
cleaned << line.replace(line.find(","),string::npos," ").substr(check+4) << '\n';
final << input +line.substr(check+4) << '\n';
}
}
return 0;
}