Hey guys I made this program that works fine but the thing is I have to add a feature that will ask the user if they have more records to add to the file. Keep adding records until the response is No. Thanks.
#include <iostream>
#include <fstream>
using namespace std;
int main(){
ofstream outputFile("TestbyCox.txt"); //ofstream will create the file if it doesn't exist, ifstream will not
ifstream inputFile; // input file
char myString[100]; // length of the string
cout << "Enter a string: ";
cin.getline( myString, 100, '\n');
cout << "Writting string to file...\n";
outputFile << myString;
outputFile.close();
inputFile.open("TestbyCox.txt");
cout << "Reading string from file...\n";
inputFile.getline(myString, 100, '\n');
cout << myString; // Displaying the file contents
system("pause");
return 0;
}