Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // reading a text file
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main() {
- string barcode;
- ifstream myInputFile("input.txt");
- ofstream myOutPutFile("test.txt", ofstream::out);
- int count = 1;
- if (myInputFile.is_open())
- {
- while (getline(myInputFile, barcode, '*'))
- {
- barcode = barcode.substr(1, barcode.size() - 1);
- cout << count << '=' << barcode << '\n';
- myOutPutFile << count << '=' << barcode << '\n';
- count++;
- }
- myInputFile.close();
- myOutPutFile.close();
- }
- else {
- cout << "Unable to open input file";
- }
- std::cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement