Question: Problem 2 (Save and Get Info) : C++ language. Write a program that asks for the user's name, phone number, and address. The program then

Problem 2(Save and Get Info) : C++ language. Write a program that asks for the user's name, phone number, and address. The program then saves all information in a data file (each information in one line) namedlist.txt. Finally, the program reads the information from the file and displays it on the screenin the following format: Name: User's Name Phone Number: User's Phone Number Address: User's Street Address User's City, State, and Zip Code

This is what I have:

#include #include #include using namespace std; int main() { fstream file; file.open("list.txt", ios::out); string name, phone, address, street, city, state, zip;

// User Input cout > name; cout > phone; cout > street; cout > state; cout > city; cout > zip;

file file file file file file

file.open("list.txt", ios::in);

getline(file, name); getline(file, phone); getline(file, street); getline(file, city); getline(file, state); getline(file, zip);

cout cout cout

system("pause"); return 0; } Icantfigure out how to be ableto togettwo worditems like first name and last name without it skipping othercinfunctions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!