Using C Please Create a list management program with file ac
Using C++ Please.
Create a list management program with file access Requirements: (1) Read names from the input file. Hint: Use an array of strings and file access (2) Receive a name from a keyboard and replace the existing name with the new name. Hint: Use string manipulation. (3) Repeat Number 2 until a user specifies to end. Hint: Use a loop 4) Write the modified names list to an output file. (5 You must use both input and output files in order to receive any credit.Solution
#include <iostream>
#include <fstream.h>
#include <string.h>
int main(){
String inputFile;
String outputFile;
cout<<\"Please Enter the name of the file you wish to open\";
cin>>inputFile;
cout<<\"Please Enter the name of the file you wish to write\";
cin>>outputFile;
ostream outFile(outputFile);
istream readFile(inputFile);
string readout;
string search, Fname;
unsigned int skipLines = 0;
cout << \"Please Enter a name\";
cin >> search;
cout << search;
cout<<\"replaces\"
cin >> Fname;
while(getline(readFile,readout)) {
if (skipLines != 0) {
skipLines--;
continue;
}
else if (readout == search) {
outFile << search << endl;
outFile << Fname << endl;
outFile << Lname << endl;
skipLines = 2;
}
else {
outFile << readout;
}
}
}
