Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm needing help with the following c++ code: Write a C++ program that stores data to a text file. The data will be a persons

I'm needing help with the following c++ code:

Write a C++ program that stores data to a text file. The data will be a persons name followed by their age. The program should:

Have a menu that asks the user if they want to see the data in the file or write data to the file.

Have a header file that contains two functions. One gets the data from the file and the other puts the data into the file.

The write data option from the menu should call another function that receives the data from the user. Once the user has finished typing a name it should prompt them for the persons age. These two pieces of information should be stored in a vector as a single string entry delimited by some character of your choice. This function should then pass the vector to the function in the header file that stores the data into the .txt file.

The function in the main that views the data should retrieve the data using the getData function in the header file and then parse each line from the vector using methods of the string class such as str.find() and str.substr(). It should output each line as it reads it. This function should have a void return type. The output should look like this:

Name: Vanna White

Age: 56

Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

c. What groups were least represented? Why do you think this is so?

Answered: 1 week ago