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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main (){
string inputfile;
cout<<"Make sure file is contained within folder that this programs is contained in...\n\n";
cout<<'\n'<<'\n';
cout<<"Enter name of file to be convert from from comma delimited\n to space delimited (add .txt ext):\n\n\n";
cin>>inputfile;
cout<<'\n'<<'\n';
////////////////////////////////////////////
///////////////////////////////////////////
ofstream outputfile ("intfileconv.txt");
if(!outputfile.is_open()) cout << "\nERROR:File Write"<<'\n';
ifstream firstfile(inputfile.c_str());
if(!firstfile.is_open()) cout<<"\nERROR:File Open"<<'\n';
string p,e,n,z,d;
while(firstfile.good()){
getline(firstfile,p,',');
getline(firstfile,e,',');
getline(firstfile,n,',');
getline(firstfile,z,',');
getline(firstfile,d,'\n');
cout<<p<<" "<<e<<" "<<n<<" "<<z<<" "<<d<<'\n';
outputfile<<p<<" "<<e<<" "<<n<<" "<<z<<" "<<d<<'\n';
p<=p;
}
firstfile.close();
firstfile.clear();
outputfile.close();
outputfile.clear();
/////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
string E1,E2,E3,E4,E5,E6,E7,E8,E9,E10,E11;
string
A1,B1,C1,D1,
A2,B2,C2,D2,
A3,B3,C3,D3,
A4,B4,C4,D4,
A5,B5,C5,D5,
A6,B6,C6,D6,
A7,B7,C7,D7,
A8,B8,C8,D8,
A9,B9,C9,D9,
A10,B10,C10,D10,
A11,B11,C11,D11;
//___________________________________________________________________
//___________________________________________________________________
//Open file
int i,j;
string s2;
string s3 ="";
cout <<"\n\n\n________________________________________________\n\n\n";
cout << "Input search filter: ";
cin >>s2;
cout <<'\n';
ifstream infile ("intfileconv.txt");
if (infile.is_open()){
//Test descriptions for control
infile >>A1>>B1>>C1>>D1>>E1>>
A2>>B2>>C2>>D2>>E2>>
A3>>B3>>C3>>D3>>E3>>
A4>>B4>>C4>>D4>>E4>>
A5>>B5>>C5>>D5>>E5>>
A6>>B6>>C6>>D6>>E6>>
A7>>B7>>C7>>D7>>E7>>
A8>>B8>>C8>>D8>>E8>>
A9>>B9>>C9>>D9>>E9>>
A10>>B10>>C10>>D10>>E10;
if(E1.find(s2) !=string::npos){cout<<A1<<","<<B1<<","<<C1<<","<<D1<<","<<E1<<endl;}
if(E2.find(s2) !=string::npos){cout<<A2<<","<<B2<<","<<C2<<","<<D2<<","<<E2<<endl;}
if(E3.find(s2) !=string::npos){cout<<A3<<","<<B3<<","<<C3<<","<<D3<<","<<E3<<endl;}
if(E4.find(s2) !=string::npos){cout<<A4<<","<<B4<<","<<C4<<","<<D4<<","<<E4<<endl;}
if(E5.find(s2) !=string::npos){cout<<A5<<","<<B5<<","<<C5<<","<<D5<<","<<E5<<endl;}
if(E6.find(s2) !=string::npos){cout<<A6<<","<<B6<<","<<C6<<","<<D6<<","<<E6<<endl;}
if(E7.find(s2) !=string::npos){cout<<A7<<","<<B7<<","<<C7<<","<<D7<<","<<E7<<endl;}
if(E8.find(s2) !=string::npos){cout<<A8<<","<<B8<<","<<C8<<","<<D8<<","<<E8<<endl;}
if(E9.find(s2) !=string::npos){cout<<A9<<","<<B9<<","<<C9<<","<<D9<<","<<E9<<endl;}
if(E10.find(s2) !=string::npos){cout<<A10<<","<<B10<<","<<C10<<","<<D10<<","<<E10<<endl;}
//infile.close();
}
else cout <<"Unable to open file!";
cout<< "\n\nThank you for using this program! :-)\n\n";
cin>>i;
}
|