C++ can write to and read from files using <fstream>.
We use ofstream to write, ifstream to read.
#include <fstream> — gives access to file streamsofstream outFile("filename.txt") — creates/open file to writeoutFile << "text"; — writes to fileifstream inFile("filename.txt") — opens file for readinggetline(inFile, var) — reads one line into a string variableclose() — closes the file stream