Hello! My professor gave an assignment where I needed to use data from an existing text file, edit it, and output it to a new file. I'm a bit new to programming so I'm unsure how to go about this. I've looked at a few articles and videos, but they weren't specific enough. If possible could I get some tips or even an example. Thank you!
We don't do homeworks here but we sure help you with specific questions you have.
Below is a sample code format you probably will need.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <fstream> // include this library
ifstream inputFile; // declare input - output files
ofstream outputFile;
inputFile.open("filename.txt"); // open files
outputFile.open("filename.txt");
string data;
inputFile >> data; // get data from file
data = whatEverYouwant; // edit data
outputFile << data << endl; // output data to fil