Question: Combine the following programs to do the following: a. Create the file Friends.txt b. Based on users input, write the names of three friends to
Combine the following programs to do the following: a. Create the file Friends.txt b. Based on users input, write the names of three friends to the Friends.txt file c. Read the three names from the Friends.txt file and display (to the screen) the three names d. Close the file //This program writes user input to a file. #include ***Program 2 // This program reads data from a file. #include int main() { ifstream inputFile; string name; inputFile.open("Friends.text"); cout << "Reading data from the file. "; inputFile >> name; cout << name << endl; inputFile >> name; cout << name <
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
