#include #include #include using namespace std; int main() { string fileContent; // Create and open a text file ofstream fileWrite; fileWrite.open("data.txt"); // Write to the file if (fileWrite.is_open()) { fileWrite << "KAL KAL"; } fileWrite.close(); ifstream fileRead; // Read the text file fileRead.open("data.txt"); cout << "read..." << endl; if (fileRead.is_open()) { while (getline(fileRead, fileContent)) { //read data from file object and put it into string. cout << fileContent << "\n"; //print the data of the string } } // Close the file fileRead.close(); }